From d60ca8e96bbc16b13f8f3456f30ebeb16d0d1e47 Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Thu, 20 Apr 2017 10:08:02 +0530 Subject: 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 Reviewed-on: https://review.gluster.org/17085 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Raghavendra G --- xlators/cluster/dht/src/dht-inode-read.c | 39 ++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'xlators/cluster/dht/src/dht-inode-read.c') diff --git a/xlators/cluster/dht/src/dht-inode-read.c b/xlators/cluster/dht/src/dht-inode-read.c index 58168dec81b..c53662d6740 100644 --- a/xlators/cluster/dht/src/dht-inode-read.c +++ b/xlators/cluster/dht/src/dht-inode-read.c @@ -76,7 +76,7 @@ dht_open2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) if (we_are_not_migrating (ret)) { /* This DHT layer is not migrating the file */ DHT_STACK_UNWIND (open, frame, -1, local->op_errno, - NULL, NULL); + NULL, local->rebalance.xdata); return 0; } @@ -88,7 +88,7 @@ dht_open2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) STACK_WIND_COOKIE (frame, dht_open_cbk, subvol, subvol, subvol->fops->open, &local->loc, - local->rebalance.flags, local->fd, NULL); + local->rebalance.flags, local->fd, local->xattr_req); return 0; out: @@ -122,6 +122,8 @@ dht_open (call_frame_t *frame, xlator_t *this, op_errno = EINVAL; goto err; } + if (xdata) + local->xattr_req = dict_ref (xdata); local->rebalance.flags = flags; local->call_cnt = 1; @@ -239,10 +241,12 @@ dht_attr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) if (local->fop == GF_FOP_FSTAT) { STACK_WIND_COOKIE (frame, dht_file_attr_cbk, subvol, subvol, - subvol->fops->fstat, local->fd, NULL); + subvol->fops->fstat, local->fd, + local->xattr_req); } else { STACK_WIND_COOKIE (frame, dht_file_attr_cbk, subvol, subvol, - subvol->fops->stat, &local->loc, NULL); + subvol->fops->stat, &local->loc, + local->xattr_req); } return 0; @@ -325,6 +329,8 @@ dht_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) op_errno = EINVAL; goto err; } + if (xdata) + local->xattr_req = dict_ref (xdata); if (IA_ISREG (loc->inode->ia_type)) { local->call_cnt = 1; @@ -384,6 +390,8 @@ dht_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) op_errno = EINVAL; goto err; } + if (xdata) + local->xattr_req = dict_ref (xdata); if (IA_ISREG (fd->inode->ia_type)) { local->call_cnt = 1; @@ -504,7 +512,7 @@ dht_readv2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) STACK_WIND (frame, dht_readv_cbk, subvol, subvol->fops->readv, local->fd, local->rebalance.size, local->rebalance.offset, - local->rebalance.flags, NULL); + local->rebalance.flags, local->xattr_req); return 0; @@ -539,6 +547,8 @@ dht_readv (call_frame_t *frame, xlator_t *this, op_errno = EINVAL; goto err; } + if (xdata) + local->xattr_req = dict_ref (xdata); local->rebalance.offset = off; local->rebalance.size = size; @@ -635,7 +645,7 @@ dht_access2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) STACK_WIND_COOKIE (frame, dht_access_cbk, subvol, subvol, subvol->fops->access, &local->loc, - local->rebalance.flags, NULL); + local->rebalance.flags, local->xattr_req); return 0; @@ -674,6 +684,8 @@ dht_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask, op_errno = EINVAL; goto err; } + if (xdata) + local->xattr_req = dict_ref (xdata); STACK_WIND_COOKIE (frame, dht_access_cbk, subvol, subvol, subvol->fops->access, loc, mask, xdata); @@ -708,9 +720,6 @@ dht_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_ret = op_ret; local->op_errno = op_errno; - if (xdata) - local->rebalance.xdata = dict_ref (xdata); - /* If context is set, then send flush() it to the destination */ dht_inode_ctx_get_mig_info (this, local->fd->inode, NULL, &subvol); if (subvol && dht_fd_open_on_dst (this, local->fd, subvol)) { @@ -751,7 +760,7 @@ dht_flush2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) STACK_WIND (frame, dht_flush_cbk, subvol, subvol->fops->flush, local->fd, - local->rebalance.xdata); + local->xattr_req); return 0; @@ -785,6 +794,8 @@ dht_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) op_errno = EINVAL; goto err; } + if (xdata) + local->xattr_req = dict_ref (xdata); local->call_cnt = 1; @@ -908,7 +919,7 @@ dht_fsync2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) STACK_WIND_COOKIE (frame, dht_fsync_cbk, subvol, subvol, subvol->fops->fsync, local->fd, - local->rebalance.flags, NULL); + local->rebalance.flags, local->xattr_req); return 0; @@ -935,6 +946,8 @@ dht_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync, goto err; } + if (xdata) + local->xattr_req = dict_ref (xdata); local->call_cnt = 1; local->rebalance.flags = datasync; @@ -1025,7 +1038,7 @@ dht_lk2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret) STACK_WIND (frame, dht_lk_cbk, subvol, subvol->fops->lk, local->fd, local->rebalance.lock_cmd, &local->rebalance.flock, - local->rebalance.xdata); + local->xattr_req); return 0; @@ -1060,6 +1073,8 @@ dht_lk (call_frame_t *frame, xlator_t *this, op_errno = EINVAL; goto err; } + if (xdata) + local->xattr_req = dict_ref (xdata); local->rebalance.flock = *flock; local->rebalance.lock_cmd = cmd; -- cgit