3604df
From 272082ffde8507dc93f802a809265f2622933426 Mon Sep 17 00:00:00 2001
3604df
From: Krutika Dhananjay <kdhananj@redhat.com>
3604df
Date: Thu, 20 Apr 2017 10:08:02 +0530
3604df
Subject: [PATCH 313/316] cluster/dht: Pass the req dict instead of NULL in
3604df
 dht_attr2()
3604df
3604df
        Backport of: https://review.gluster.org/17085
3604df
3604df
This bug was causing VMs to pause during rebalance. When qemu winds
3604df
down a STAT, shard fills the trusted.glusterfs.shard.file-size attribute
3604df
in the req dict which DHT doesn't wind its STAT fop with upon detecting
3604df
the file has undergone migration. As a result shard doesn't find the
3604df
value to this key in the unwind path, causing it to fail the STAT
3604df
with EINVAL.
3604df
3604df
Also, the same bug exists in other fops too, which is also fixed in
3604df
this patch.
3604df
3604df
Change-Id: I1c19b98c1c002c90a17c5becff1cb70d0fd8017c
3604df
BUG: 1439753
3604df
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/105197
3604df
Reviewed-by: Nithya Balachandran <nbalacha@redhat.com>
3604df
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
3604df
---
3604df
 xlators/cluster/dht/src/dht-common.c      | 61 +++++++++++++------------------
3604df
 xlators/cluster/dht/src/dht-inode-read.c  | 37 +++++++++++++------
3604df
 xlators/cluster/dht/src/dht-inode-write.c | 33 ++++++++++++-----
3604df
 3 files changed, 74 insertions(+), 57 deletions(-)
3604df
3604df
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
3604df
index d54405b..93bb2ad 100644
3604df
--- a/xlators/cluster/dht/src/dht-common.c
3604df
+++ b/xlators/cluster/dht/src/dht-common.c
3604df
@@ -3639,6 +3639,7 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this,
3604df
                 goto err;
3604df
         }
3604df
 
3604df
+        local->xattr_req = xdata ? dict_ref (xdata) : dict_new ();
3604df
         local->call_cnt = call_cnt = layout->cnt;
3604df
 
3604df
         if (IA_ISDIR (fd->inode->ia_type)) {
3604df
@@ -3646,7 +3647,7 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this,
3604df
                         STACK_WIND (frame, dht_err_cbk,
3604df
                                     layout->list[i].xlator,
3604df
                                     layout->list[i].xlator->fops->fsetxattr,
3604df
-                                    fd, xattr, flags, NULL);
3604df
+                                    fd, xattr, flags, xdata);
3604df
                 }
3604df
 
3604df
         } else {
3604df
@@ -3655,10 +3656,8 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this,
3604df
                 local->rebalance.xattr = dict_ref (xattr);
3604df
                 local->rebalance.flags = flags;
3604df
 
3604df
-                xdata = xdata ? dict_ref (xdata) : dict_new ();
3604df
-                if (xdata)
3604df
-                        ret = dict_set_dynstr_with_alloc (xdata,
3604df
-                                        DHT_IATT_IN_XDATA_KEY, "yes");
3604df
+                ret = dict_set_dynstr_with_alloc (local->xattr_req,
3604df
+                                                  DHT_IATT_IN_XDATA_KEY, "yes");
3604df
                 if (ret) {
3604df
                         gf_msg_debug (this->name, 0,
3604df
                                       "Failed to set dictionary key %s for fd=%p",
3604df
@@ -3666,11 +3665,8 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this,
3604df
                 }
3604df
 
3604df
                 STACK_WIND (frame, dht_file_setxattr_cbk, subvol,
3604df
-                    subvol->fops->fsetxattr, fd, xattr, flags, xdata);
3604df
-
3604df
-                if (xdata)
3604df
-                        dict_unref (xdata);
3604df
-
3604df
+                            subvol->fops->fsetxattr, fd, xattr, flags,
3604df
+                            local->xattr_req);
3604df
         }
3604df
         return 0;
3604df
 
3604df
@@ -3766,12 +3762,12 @@ dht_setxattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
                 STACK_WIND (frame, dht_file_setxattr_cbk, subvol,
3604df
                             subvol->fops->setxattr, &local->loc,
3604df
                             local->rebalance.xattr, local->rebalance.flags,
3604df
-                            NULL);
3604df
+                            local->xattr_req);
3604df
         } else {
3604df
                 STACK_WIND (frame, dht_file_setxattr_cbk, subvol,
3604df
                             subvol->fops->fsetxattr, local->fd,
3604df
                             local->rebalance.xattr, local->rebalance.flags,
3604df
-                            NULL);
3604df
+                            local->xattr_req);
3604df
         }
3604df
 
3604df
         return 0;
3604df
@@ -4046,6 +4042,7 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
3604df
         if (tmp) {
3604df
                 return dht_nuke_dir (frame, this, loc, tmp);
3604df
         }
3604df
+        local->xattr_req = xdata ? dict_ref (xdata) : dict_new ();
3604df
 
3604df
         if (IA_ISDIR (loc->inode->ia_type)) {
3604df
 
3604df
@@ -4062,17 +4059,12 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
3604df
                 local->rebalance.flags = flags;
3604df
                 local->call_cnt = 1;
3604df
 
3604df
-                xdata = xdata ? dict_ref (xdata) : dict_new ();
3604df
-                if (xdata)
3604df
-                        ret = dict_set_dynstr_with_alloc (xdata,
3604df
-                                              DHT_IATT_IN_XDATA_KEY, "yes");
3604df
+                ret = dict_set_dynstr_with_alloc (local->xattr_req,
3604df
+                                                  DHT_IATT_IN_XDATA_KEY, "yes");
3604df
 
3604df
                 STACK_WIND (frame, dht_file_setxattr_cbk,
3604df
                             subvol, subvol->fops->setxattr,
3604df
-                            loc, xattr, flags, xdata);
3604df
-
3604df
-                if (xdata)
3604df
-                        dict_unref (xdata);
3604df
+                            loc, xattr, flags, local->xattr_req);
3604df
         }
3604df
 
3604df
         return 0;
3604df
@@ -4187,11 +4179,11 @@ dht_removexattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame,
3604df
         if (local->fop == GF_FOP_REMOVEXATTR) {
3604df
                 STACK_WIND (frame, dht_file_removexattr_cbk, subvol,
3604df
                             subvol->fops->removexattr, &local->loc,
3604df
-                            local->key, NULL);
3604df
+                            local->key, local->xattr_req);
3604df
         } else {
3604df
                 STACK_WIND (frame, dht_file_removexattr_cbk, subvol,
3604df
                             subvol->fops->fremovexattr, local->fd,
3604df
-                            local->key, NULL);
3604df
+                            local->key, local->xattr_req);
3604df
         }
3604df
 
3604df
         return 0;
3604df
@@ -4228,8 +4220,6 @@ dht_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
3604df
 unlock:
3604df
         UNLOCK (&frame->lock);
3604df
 
3604df
-
3604df
-
3604df
         this_call_cnt = dht_frame_return (frame);
3604df
         if (is_last_call (this_call_cnt)) {
3604df
                 DHT_STACK_UNWIND (removexattr, frame, local->op_ret,
3604df
@@ -4285,6 +4275,7 @@ dht_removexattr (call_frame_t *frame, xlator_t *this,
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
+        local->xattr_req = (xdata) ? dict_ref (xdata) : dict_new ();
3604df
 
3604df
         local->call_cnt = call_cnt = layout->cnt;
3604df
         local->key = gf_strdup (key);
3604df
@@ -4294,16 +4285,15 @@ dht_removexattr (call_frame_t *frame, xlator_t *this,
3604df
                         STACK_WIND (frame, dht_removexattr_cbk,
3604df
                                     layout->list[i].xlator,
3604df
                                     layout->list[i].xlator->fops->removexattr,
3604df
-                                    loc, key, NULL);
3604df
+                                    loc, key, local->xattr_req);
3604df
                 }
3604df
 
3604df
         } else {
3604df
 
3604df
                 local->call_cnt = 1;
3604df
-                xdata = xdata ? dict_ref (xdata) : dict_new ();
3604df
-                if (xdata)
3604df
-                        ret = dict_set_dynstr_with_alloc (xdata,
3604df
-                                 DHT_IATT_IN_XDATA_KEY, "yes");
3604df
+
3604df
+                ret = dict_set_dynstr_with_alloc (local->xattr_req,
3604df
+                                                  DHT_IATT_IN_XDATA_KEY, "yes");
3604df
                 if (ret) {
3604df
                         gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
3604df
                                 DHT_MSG_DICT_SET_FAILED, "Failed to "
3604df
@@ -4313,10 +4303,7 @@ dht_removexattr (call_frame_t *frame, xlator_t *this,
3604df
 
3604df
                 STACK_WIND (frame, dht_file_removexattr_cbk,
3604df
                             subvol, subvol->fops->removexattr,
3604df
-                            loc, key, xdata);
3604df
-
3604df
-                if (xdata)
3604df
-                        dict_unref (xdata);
3604df
+                            loc, key, local->xattr_req);
3604df
         }
3604df
 
3604df
         return 0;
3604df
@@ -6314,7 +6301,7 @@ dht_link2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
         local->call_cnt = 2;
3604df
 
3604df
         STACK_WIND (frame, dht_link_cbk, subvol, subvol->fops->link,
3604df
-                    &local->loc, &local->loc2, NULL);
3604df
+                    &local->loc, &local->loc2, local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 err:
3604df
@@ -6341,7 +6328,7 @@ dht_link_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
3604df
         srcvol = local->linkfile.srcvol;
3604df
 
3604df
         STACK_WIND (frame, dht_link_cbk, srcvol, srcvol->fops->link,
3604df
-                    &local->loc, &local->loc2, xdata);
3604df
+                    &local->loc, &local->loc2, local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 
3604df
@@ -6350,7 +6337,7 @@ err:
3604df
         dht_set_fixed_dir_stat (preparent);
3604df
         dht_set_fixed_dir_stat (postparent);
3604df
         DHT_STACK_UNWIND (link, frame, op_ret, op_errno, inode, stbuf, preparent,
3604df
-                          postparent, NULL);
3604df
+                          postparent, xdata);
3604df
 
3604df
         return 0;
3604df
 }
3604df
@@ -6401,6 +6388,8 @@ dht_link (call_frame_t *frame, xlator_t *this,
3604df
                 op_errno = ENOMEM;
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         if (hashed_subvol != cached_subvol) {
3604df
                 gf_uuid_copy (local->gfid, oldloc->inode->gfid);
3604df
diff --git a/xlators/cluster/dht/src/dht-inode-read.c b/xlators/cluster/dht/src/dht-inode-read.c
3604df
index 8abf0d5..298eca7 100644
3604df
--- a/xlators/cluster/dht/src/dht-inode-read.c
3604df
+++ b/xlators/cluster/dht/src/dht-inode-read.c
3604df
@@ -76,7 +76,7 @@ dht_open2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
         if (we_are_not_migrating (ret)) {
3604df
                 /* This DHT layer is not migrating the file */
3604df
                 DHT_STACK_UNWIND (open, frame, -1, local->op_errno,
3604df
-                                  NULL, NULL);
3604df
+                                  NULL, local->rebalance.xdata);
3604df
                 return 0;
3604df
 
3604df
         }
3604df
@@ -88,7 +88,7 @@ dht_open2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
 
3604df
         STACK_WIND (frame, dht_open_cbk, subvol, subvol->fops->open,
3604df
                     &local->loc, local->rebalance.flags, local->fd,
3604df
-                    NULL);
3604df
+                    local->xattr_req);
3604df
         return 0;
3604df
 
3604df
 out:
3604df
@@ -122,6 +122,8 @@ dht_open (call_frame_t *frame, xlator_t *this,
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         local->rebalance.flags = flags;
3604df
         local->call_cnt = 1;
3604df
@@ -239,10 +241,10 @@ dht_attr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
 
3604df
         if (local->fop == GF_FOP_FSTAT) {
3604df
                 STACK_WIND (frame, dht_file_attr_cbk, subvol,
3604df
-                            subvol->fops->fstat, local->fd, NULL);
3604df
+                            subvol->fops->fstat, local->fd, local->xattr_req);
3604df
         } else {
3604df
                 STACK_WIND (frame, dht_file_attr_cbk, subvol,
3604df
-                            subvol->fops->stat, &local->loc, NULL);
3604df
+                            subvol->fops->stat, &local->loc, local->xattr_req);
3604df
         }
3604df
 
3604df
         return 0;
3604df
@@ -325,6 +327,8 @@ dht_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         if (IA_ISREG (loc->inode->ia_type)) {
3604df
                 local->call_cnt = 1;
3604df
@@ -385,6 +389,8 @@ dht_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         if (IA_ISREG (fd->inode->ia_type)) {
3604df
                 local->call_cnt = 1;
3604df
@@ -506,7 +512,7 @@ dht_readv2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
 
3604df
         STACK_WIND (frame, dht_readv_cbk, subvol, subvol->fops->readv,
3604df
                     local->fd, local->rebalance.size, local->rebalance.offset,
3604df
-                    local->rebalance.flags, NULL);
3604df
+                    local->rebalance.flags, local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 
3604df
@@ -541,6 +547,8 @@ dht_readv (call_frame_t *frame, xlator_t *this,
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         local->rebalance.offset = off;
3604df
         local->rebalance.size   = size;
3604df
@@ -635,7 +643,7 @@ dht_access2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
         local->call_cnt = 2;
3604df
 
3604df
         STACK_WIND (frame, dht_access_cbk, subvol, subvol->fops->access,
3604df
-                    &local->loc, local->rebalance.flags, NULL);
3604df
+                    &local->loc, local->rebalance.flags, local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 
3604df
@@ -674,6 +682,8 @@ dht_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask,
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         STACK_WIND (frame, dht_access_cbk, subvol, subvol->fops->access,
3604df
                     loc, mask, xdata);
3604df
@@ -708,9 +718,6 @@ dht_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
3604df
         local->op_ret = op_ret;
3604df
         local->op_errno = op_errno;
3604df
 
3604df
-        if (xdata)
3604df
-                local->rebalance.xdata = dict_ref (xdata);
3604df
-
3604df
         /* If context is set, then send flush() it to the destination */
3604df
         dht_inode_ctx_get_mig_info (this, local->fd->inode, NULL, &subvol);
3604df
         if (subvol && dht_fd_open_on_dst (this, local->fd, subvol)) {
3604df
@@ -751,7 +758,7 @@ dht_flush2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
 
3604df
         STACK_WIND (frame, dht_flush_cbk,
3604df
                     subvol, subvol->fops->flush, local->fd,
3604df
-                    local->rebalance.xdata);
3604df
+                    local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 
3604df
@@ -785,6 +792,8 @@ dht_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         local->call_cnt = 1;
3604df
 
3604df
@@ -907,7 +916,7 @@ dht_fsync2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
         local->call_cnt = 2; /* This is the second attempt */
3604df
 
3604df
         STACK_WIND (frame, dht_fsync_cbk, subvol, subvol->fops->fsync,
3604df
-                    local->fd, local->rebalance.flags, NULL);
3604df
+                    local->fd, local->rebalance.flags, local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 
3604df
@@ -934,6 +943,8 @@ dht_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync,
3604df
 
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         local->call_cnt = 1;
3604df
         local->rebalance.flags = datasync;
3604df
@@ -1024,7 +1035,7 @@ dht_lk2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
 
3604df
         STACK_WIND (frame, dht_lk_cbk, subvol, subvol->fops->lk, local->fd,
3604df
                     local->rebalance.lock_cmd, &local->rebalance.flock,
3604df
-                    local->rebalance.xdata);
3604df
+                    local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 
3604df
@@ -1059,6 +1070,8 @@ dht_lk (call_frame_t *frame, xlator_t *this,
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         local->rebalance.flock = *flock;
3604df
         local->rebalance.lock_cmd = cmd;
3604df
diff --git a/xlators/cluster/dht/src/dht-inode-write.c b/xlators/cluster/dht/src/dht-inode-write.c
3604df
index 112685b..364b66c 100644
3604df
--- a/xlators/cluster/dht/src/dht-inode-write.c
3604df
+++ b/xlators/cluster/dht/src/dht-inode-write.c
3604df
@@ -143,7 +143,7 @@ dht_writev2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
                     subvol, subvol->fops->writev,
3604df
                     local->fd, local->rebalance.vector, local->rebalance.count,
3604df
                     local->rebalance.offset, local->rebalance.flags,
3604df
-                    local->rebalance.iobref, NULL);
3604df
+                    local->rebalance.iobref, local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 
3604df
@@ -180,7 +180,8 @@ dht_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
-
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         local->rebalance.vector = iov_dup (vector, count);
3604df
         local->rebalance.offset = off;
3604df
@@ -323,11 +324,11 @@ dht_truncate2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
         if (local->fop == GF_FOP_TRUNCATE) {
3604df
                 STACK_WIND (frame, dht_truncate_cbk, subvol,
3604df
                             subvol->fops->truncate, &local->loc,
3604df
-                            local->rebalance.offset, NULL);
3604df
+                            local->rebalance.offset, local->xattr_req);
3604df
         } else {
3604df
                 STACK_WIND (frame, dht_truncate_cbk, subvol,
3604df
                             subvol->fops->ftruncate, local->fd,
3604df
-                            local->rebalance.offset, NULL);
3604df
+                            local->rebalance.offset, local->xattr_req);
3604df
         }
3604df
 
3604df
         return 0;
3604df
@@ -366,6 +367,8 @@ dht_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         STACK_WIND (frame, dht_truncate_cbk,
3604df
                     subvol, subvol->fops->truncate,
3604df
@@ -407,6 +410,8 @@ dht_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         STACK_WIND (frame, dht_truncate_cbk,
3604df
                     subvol, subvol->fops->ftruncate,
3604df
@@ -533,7 +538,7 @@ dht_fallocate2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
 
3604df
 	STACK_WIND(frame, dht_fallocate_cbk, subvol, subvol->fops->fallocate,
3604df
 		   local->fd, local->rebalance.flags, local->rebalance.offset,
3604df
-		   local->rebalance.size, NULL);
3604df
+		   local->rebalance.size, local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 
3604df
@@ -572,6 +577,8 @@ dht_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode,
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         STACK_WIND (frame, dht_fallocate_cbk,
3604df
                     subvol, subvol->fops->fallocate,
3604df
@@ -698,7 +705,7 @@ dht_discard2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
 
3604df
 	STACK_WIND(frame, dht_discard_cbk, subvol, subvol->fops->discard,
3604df
 		   local->fd, local->rebalance.offset, local->rebalance.size,
3604df
-		   NULL);
3604df
+		   local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 
3604df
@@ -736,6 +743,8 @@ dht_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         STACK_WIND (frame, dht_discard_cbk, subvol, subvol->fops->discard,
3604df
                     fd, offset, len, xdata);
3604df
@@ -861,7 +870,7 @@ dht_zerofill2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
 
3604df
         STACK_WIND(frame, dht_zerofill_cbk, subvol, subvol->fops->zerofill,
3604df
                    local->fd, local->rebalance.offset, local->rebalance.size,
3604df
-                   NULL);
3604df
+                   local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 
3604df
@@ -900,6 +909,8 @@ dht_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         STACK_WIND (frame, dht_zerofill_cbk, subvol, subvol->fops->zerofill,
3604df
                     fd, offset, len, xdata);
3604df
@@ -1004,12 +1015,12 @@ dht_setattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
                 STACK_WIND (frame, dht_file_setattr_cbk, subvol,
3604df
                             subvol->fops->setattr, &local->loc,
3604df
                             &local->rebalance.stbuf, local->rebalance.flags,
3604df
-                            NULL);
3604df
+                            local->xattr_req);
3604df
         } else {
3604df
                 STACK_WIND (frame, dht_file_setattr_cbk, subvol,
3604df
                             subvol->fops->fsetattr, local->fd,
3604df
                             &local->rebalance.stbuf, local->rebalance.flags,
3604df
-                            NULL);
3604df
+                            local->xattr_req);
3604df
         }
3604df
 
3604df
         return 0;
3604df
@@ -1102,6 +1113,8 @@ dht_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         if (IA_ISREG (loc->inode->ia_type)) {
3604df
                 /* in the regular file _cbk(), we need to check for
3604df
@@ -1173,6 +1186,8 @@ dht_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt *stbuf,
3604df
                 op_errno = EINVAL;
3604df
                 goto err;
3604df
         }
3604df
+        if (xdata)
3604df
+                local->xattr_req = dict_ref (xdata);
3604df
 
3604df
         if (IA_ISREG (fd->inode->ia_type)) {
3604df
                 /* in the regular file _cbk(), we need to check for
3604df
-- 
3604df
1.8.3.1
3604df