diff options
author | Dan Lambright <dlambrig@redhat.com> | 2014-12-16 10:28:57 -0500 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2015-02-13 07:19:46 -0800 |
commit | 04c4ec96b88ee6392812a511de32b48bbe63a421 (patch) | |
tree | 09ff8b662663bd99fb38cfd44b5b564bbfc5ec8e /xlators/cluster/dht/src | |
parent | 47f6f41f1204d0a1fd3cb699919c757d3238fdf3 (diff) |
cluster/dht: Modify dht-rebalance.c to use trusted.distribute.migrate-data
rather than distribute.migrate-data and work with CLI.
The change makes this work both when it is internally driven and from the
shell. The problem is further described in bugzilla # 1147107.
Change-Id: I4fe04cae661dca25432530ddf5ac6ff2c957d6b3
BUG: 1147107
Signed-off-by: Dan Lambright <dlambrig@redhat.com>
Reviewed-on: http://review.gluster.org/9284
Reviewed-by: N Balachandran <nbalacha@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 23 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-common.h | 2 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 5 |
3 files changed, 25 insertions, 5 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 0ab3b200f27..d396c2ee4ab 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -3164,8 +3164,9 @@ dht_setxattr (call_frame_t *frame, xlator_t *this, local->call_cnt = call_cnt = layout->cnt; - tmp = dict_get (xattr, "distribute.migrate-data"); + tmp = dict_get (xattr, GF_XATTR_FILE_MIGRATE_KEY); if (tmp) { + if (IA_ISDIR (loc->inode->ia_type)) { op_errno = ENOTSUP; goto err; @@ -3181,7 +3182,25 @@ dht_setxattr (call_frame_t *frame, xlator_t *this, if (conf->decommission_in_progress) forced_rebalance = GF_DHT_MIGRATE_HARDLINK; - local->rebalance.target_node = dht_subvol_get_hashed (this, loc); + if (!loc->path) { + op_errno = EINVAL; + goto err; + } + + if (!local->loc.name) + local->loc.name = strrchr (local->loc.path, '/')+1; + + if (!local->loc.parent) + local->loc.parent = + inode_parent(local->loc.inode, NULL, NULL); + + if ((!local->loc.name) || (!local->loc.parent)) { + op_errno = EINVAL; + goto err; + } + + local->rebalance.target_node = + dht_subvol_get_hashed (this, &local->loc); if (!local->rebalance.target_node) { gf_msg (this->name, GF_LOG_ERROR, 0, DHT_MSG_HASHED_SUBVOL_GET_FAILED, diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 0a0ce52f3da..fabbe9e2909 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -25,11 +25,11 @@ #define _DHT_H #define GF_XATTR_FIX_LAYOUT_KEY "distribute.fix.layout" +#define GF_XATTR_FILE_MIGRATE_KEY "trusted.distribute.migrate-data" #define GF_DHT_LOOKUP_UNHASHED_ON 1 #define GF_DHT_LOOKUP_UNHASHED_AUTO 2 #define DHT_PATHINFO_HEADER "DISTRIBUTE:" #define DHT_FILE_MIGRATE_DOMAIN "dht.file.migrate" - #include <fnmatch.h> typedef int (*dht_selfheal_dir_cbk_t) (call_frame_t *frame, void *cookie, diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 66b84ba96e9..383d215d235 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -1952,10 +1952,11 @@ gf_defrag_start_crawl (void *data) } if (defrag->cmd == GF_DEFRAG_CMD_START_FORCE) ret = dict_set_str (migrate_data, - "distribute.migrate-data", "force"); + GF_XATTR_FILE_MIGRATE_KEY, + "force"); else ret = dict_set_str (migrate_data, - "distribute.migrate-data", + GF_XATTR_FILE_MIGRATE_KEY, "non-force"); if (ret) goto out; |