summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-common.c
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2017-04-20 10:08:02 +0530
committerRaghavendra G <rgowdapp@redhat.com>2017-04-24 04:12:57 +0000
commitd60ca8e96bbc16b13f8f3456f30ebeb16d0d1e47 (patch)
tree960e60cc13515e2f91aff6232d6758819e506e96 /xlators/cluster/dht/src/dht-common.c
parent05d9c5a3d684512e97327c8d73988ef7f29e1511 (diff)
cluster/dht: Pass the req dict instead of NULL in dht_attr2()
This bug was causing VMs to pause during rebalance. When qemu winds down a STAT, shard fills the trusted.glusterfs.shard.file-size attribute in the req dict which DHT doesn't wind its STAT fop with upon detecting the file has undergone migration. As a result shard doesn't find the value to this key in the unwind path, causing it to fail the STAT with EINVAL. Also, the same bug exists in other fops too, which is also fixed in this patch. Change-Id: Id7823fd932b4e5a9b8779ebb2b612a399c0ef5f0 BUG: 1440051 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: https://review.gluster.org/17085 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.c')
-rw-r--r--xlators/cluster/dht/src/dht-common.c53
1 files changed, 20 insertions, 33 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index e3af5a7fe8b..836a009c362 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -3834,6 +3834,7 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this,
goto err;
}
+ local->xattr_req = xdata ? dict_ref (xdata) : dict_new ();
local->call_cnt = call_cnt = layout->cnt;
if (IA_ISDIR (fd->inode->ia_type)) {
@@ -3842,7 +3843,7 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this,
layout->list[i].xlator,
layout->list[i].xlator,
layout->list[i].xlator->fops->fsetxattr,
- fd, xattr, flags, NULL);
+ fd, xattr, flags, xdata);
}
} else {
@@ -3851,9 +3852,7 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this,
local->rebalance.xattr = dict_ref (xattr);
local->rebalance.flags = flags;
- xdata = xdata ? dict_ref (xdata) : dict_new ();
- if (xdata)
- ret = dict_set_int8 (xdata, DHT_IATT_IN_XDATA_KEY, 1);
+ ret = dict_set_int8 (local->xattr_req, DHT_IATT_IN_XDATA_KEY, 1);
if (ret) {
gf_msg_debug (this->name, 0,
"Failed to set dictionary key %s for fd=%p",
@@ -3862,11 +3861,7 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this,
STACK_WIND_COOKIE (frame, dht_file_setxattr_cbk, subvol,
subvol, subvol->fops->fsetxattr, fd, xattr,
- flags, xdata);
-
- if (xdata)
- dict_unref (xdata);
-
+ flags, local->xattr_req);
}
return 0;
@@ -3962,12 +3957,12 @@ dht_setxattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
STACK_WIND_COOKIE (frame, dht_file_setxattr_cbk, subvol,
subvol, subvol->fops->setxattr, &local->loc,
local->rebalance.xattr,
- local->rebalance.flags, NULL);
+ local->rebalance.flags, local->xattr_req);
} else {
STACK_WIND_COOKIE (frame, dht_file_setxattr_cbk, subvol,
subvol, subvol->fops->fsetxattr, local->fd,
local->rebalance.xattr,
- local->rebalance.flags, NULL);
+ local->rebalance.flags, local->xattr_req);
}
return 0;
@@ -4251,6 +4246,7 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
if (tmp) {
return dht_nuke_dir (frame, this, loc, tmp);
}
+ local->xattr_req = xdata ? dict_ref (xdata) : dict_new ();
if (IA_ISDIR (loc->inode->ia_type)) {
@@ -4268,16 +4264,11 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
local->rebalance.flags = flags;
local->call_cnt = 1;
- xdata = xdata ? dict_ref (xdata) : dict_new ();
- if (xdata)
- ret = dict_set_int8 (xdata, DHT_IATT_IN_XDATA_KEY, 1);
+ ret = dict_set_int8 (local->xattr_req, DHT_IATT_IN_XDATA_KEY, 1);
STACK_WIND_COOKIE (frame, dht_file_setxattr_cbk, subvol,
subvol, subvol->fops->setxattr, loc, xattr,
- flags, xdata);
-
- if (xdata)
- dict_unref (xdata);
+ flags, local->xattr_req);
}
return 0;
@@ -4396,11 +4387,11 @@ dht_removexattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame,
if (local->fop == GF_FOP_REMOVEXATTR) {
STACK_WIND_COOKIE (frame, dht_file_removexattr_cbk, subvol,
subvol, subvol->fops->removexattr,
- &local->loc, local->key, NULL);
+ &local->loc, local->key, local->xattr_req);
} else {
STACK_WIND_COOKIE (frame, dht_file_removexattr_cbk, subvol,
subvol, subvol->fops->fremovexattr,
- local->fd, local->key, NULL);
+ local->fd, local->key, local->xattr_req);
}
return 0;
@@ -4437,8 +4428,6 @@ dht_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
unlock:
UNLOCK (&frame->lock);
-
-
this_call_cnt = dht_frame_return (frame);
if (is_last_call (this_call_cnt)) {
DHT_STACK_UNWIND (removexattr, frame, local->op_ret,
@@ -4494,6 +4483,7 @@ dht_removexattr (call_frame_t *frame, xlator_t *this,
op_errno = EINVAL;
goto err;
}
+ local->xattr_req = (xdata) ? dict_ref (xdata) : dict_new ();
local->call_cnt = call_cnt = layout->cnt;
local->key = gf_strdup (key);
@@ -4504,15 +4494,13 @@ dht_removexattr (call_frame_t *frame, xlator_t *this,
layout->list[i].xlator,
layout->list[i].xlator,
layout->list[i].xlator->fops->removexattr,
- loc, key, NULL);
+ loc, key, local->xattr_req);
}
} else {
local->call_cnt = 1;
- xdata = xdata ? dict_ref (xdata) : dict_new ();
- if (xdata)
- ret = dict_set_int8 (xdata, DHT_IATT_IN_XDATA_KEY, 1);
+ ret = dict_set_int8 (local->xattr_req, DHT_IATT_IN_XDATA_KEY, 1);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
DHT_MSG_DICT_SET_FAILED, "Failed to "
@@ -4522,10 +4510,7 @@ dht_removexattr (call_frame_t *frame, xlator_t *this,
STACK_WIND_COOKIE (frame, dht_file_removexattr_cbk, subvol,
subvol, subvol->fops->removexattr, loc, key,
- xdata);
-
- if (xdata)
- dict_unref (xdata);
+ local->xattr_req);
}
return 0;
@@ -6561,7 +6546,7 @@ dht_link2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
local->call_cnt = 2;
STACK_WIND (frame, dht_link_cbk, subvol, subvol->fops->link,
- &local->loc, &local->loc2, NULL);
+ &local->loc, &local->loc2, local->xattr_req);
return 0;
err:
@@ -6588,7 +6573,7 @@ dht_link_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
srcvol = local->linkfile.srcvol;
STACK_WIND (frame, dht_link_cbk, srcvol, srcvol->fops->link,
- &local->loc, &local->loc2, xdata);
+ &local->loc, &local->loc2, local->xattr_req);
return 0;
@@ -6597,7 +6582,7 @@ err:
dht_set_fixed_dir_stat (preparent);
dht_set_fixed_dir_stat (postparent);
DHT_STACK_UNWIND (link, frame, op_ret, op_errno, inode, stbuf, preparent,
- postparent, NULL);
+ postparent, xdata);
return 0;
}
@@ -6648,6 +6633,8 @@ dht_link (call_frame_t *frame, xlator_t *this,
op_errno = ENOMEM;
goto err;
}
+ if (xdata)
+ local->xattr_req = dict_ref (xdata);
if (hashed_subvol != cached_subvol) {
gf_uuid_copy (local->gfid, oldloc->inode->gfid);