diff options
Diffstat (limited to 'xlators')
-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; |