summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorDan Lambright <dlambrig@redhat.com>2015-06-26 16:33:49 -0400
committerDan Lambright <dlambrig@redhat.com>2015-07-13 09:38:57 -0700
commit67a53554ed75081612b56a5658fd569dc5aaa785 (patch)
tree7b5a7a2730452a642cc3dd0b1ce3755c8fb0c77f /xlators/cluster
parent890e58f5d4d3db9477e36cac3d16798ffe3b0480 (diff)
cluster/tier: fixes for migration over ec as cold tier
An opendir is done in rebalance. The graph constructed when EC is used in tiering may have no local volumes (if all the hot volumes are on one node and all the others on another node). Previously the opendir only sent fops down the local subvolumes for migration. They must be sent down both the hot and cold subvolumes for tiering. When setxattr2() received a NULL subvolume; this dereferenced an uninitialized variable. When a lookup is done during creation of the destination file, the xattr dict is "polluted" with virtual xattrs. These cause subsequent xattrs in the new file to not be written by posix. They are required by EC. The inode gfid for "entry_loc" in gf_defrag_migrate_single_file() was not initialized. This made underlying translators think the gfid was 0, and failed migration. Change-Id: I6ccda8ca8e43485b9b354341bbfcb302496f632c BUG: 1236212 Signed-off-by: Dan Lambright <dlambrig@redhat.com> Reviewed-on: http://review.gluster.org/11433 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/dht/src/dht-common.c6
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c8
2 files changed, 10 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 259d31a4a8c..95a9d6c4cee 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -3582,7 +3582,7 @@ dht_setxattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame)
return 0;
err:
- DHT_STACK_UNWIND (setxattr, frame, local->op_ret, op_errno, NULL);
+ DHT_STACK_UNWIND (setxattr, frame, local ? local->op_ret : -1, op_errno, NULL);
return 0;
}
@@ -4425,7 +4425,9 @@ dht_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
goto err;
}
- if (!(conf->local_subvols_cnt) || !conf->defrag) {
+ if ((conf->defrag && conf->defrag->cmd == GF_DEFRAG_CMD_START_TIER) ||
+ (conf->defrag && conf->defrag->cmd == GF_DEFRAG_CMD_START_DETACH_TIER) ||
+ (!(conf->local_subvols_cnt) || !conf->defrag)) {
local->call_cnt = conf->subvolume_cnt;
for (i = 0; i < conf->subvolume_cnt; i++) {
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 6978d788303..ec2061cbc4c 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -1546,6 +1546,7 @@ gf_defrag_migrate_single_file (void *opaque)
struct timeval end = {0,};
double elapsed = {0,};
struct dht_container *rebal_entry = NULL;
+ inode_t *inode = NULL;
rebal_entry = (struct dht_container *)opaque;
if (!rebal_entry) {
@@ -1603,8 +1604,6 @@ gf_defrag_migrate_single_file (void *opaque)
gf_uuid_copy (entry_loc.pargfid, loc->gfid);
- entry_loc.inode->ia_type = entry->d_stat.ia_type;
-
ret = syncop_lookup (this, &entry_loc, &iatt, NULL, NULL, NULL);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
@@ -1615,6 +1614,11 @@ gf_defrag_migrate_single_file (void *opaque)
goto out;
}
+ inode = inode_link (entry_loc.inode, entry_loc.parent, entry->d_name, &iatt);
+ inode_unref (entry_loc.inode);
+ /* use the inode returned by inode_link */
+ entry_loc.inode = inode;
+
ret = syncop_setxattr (this, &entry_loc, migrate_data, 0, NULL, NULL);
if (ret < 0) {
op_errno = -ret;