21ab4e
From 4c3ab2ccfb4f786060b1f11544cea51cd98019e8 Mon Sep 17 00:00:00 2001
3604df
From: Krutika Dhananjay <kdhananj@redhat.com>
3604df
Date: Thu, 20 Apr 2017 10:08:02 +0530
21ab4e
Subject: [PATCH 415/426] 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
21ab4e
Change-Id: I629e1e12e3f335a6bff7a4f15c13f2ac7c0d9ff0
21ab4e
BUG: 1434653
3604df
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/105209
3604df
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
3604df
---
21ab4e
 xlators/cluster/dht/src/dht-common.c      | 53 ++++++++++++-------------------
21ab4e
 xlators/cluster/dht/src/dht-inode-read.c  | 39 ++++++++++++++++-------
21ab4e
 xlators/cluster/dht/src/dht-inode-write.c | 33 +++++++++++++------
21ab4e
 3 files changed, 71 insertions(+), 54 deletions(-)
3604df
3604df
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
21ab4e
index 4512e29..406ec21 100644
3604df
--- a/xlators/cluster/dht/src/dht-common.c
3604df
+++ b/xlators/cluster/dht/src/dht-common.c
21ab4e
@@ -3831,6 +3831,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)) {
21ab4e
@@ -3839,7 +3840,7 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this,
21ab4e
                                            layout->list[i].xlator,
21ab4e
                                            layout->list[i].xlator,
21ab4e
                                            layout->list[i].xlator->fops->fsetxattr,
21ab4e
-                                           fd, xattr, flags, NULL);
21ab4e
+                                           fd, xattr, flags, xdata);
3604df
                 }
3604df
 
3604df
         } else {
21ab4e
@@ -3848,9 +3849,7 @@ 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)
21ab4e
-                        ret = dict_set_int8 (xdata, DHT_IATT_IN_XDATA_KEY, 1);
21ab4e
+                ret = dict_set_int8 (local->xattr_req, DHT_IATT_IN_XDATA_KEY, 1);
3604df
                 if (ret) {
3604df
                         gf_msg_debug (this->name, 0,
3604df
                                       "Failed to set dictionary key %s for fd=%p",
21ab4e
@@ -3859,11 +3858,7 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this,
3604df
 
21ab4e
                 STACK_WIND_COOKIE (frame, dht_file_setxattr_cbk, subvol,
21ab4e
                                    subvol, subvol->fops->fsetxattr, fd, xattr,
21ab4e
-                                   flags, xdata);
3604df
-
3604df
-                if (xdata)
3604df
-                        dict_unref (xdata);
3604df
-
21ab4e
+                                   flags, local->xattr_req);
3604df
         }
3604df
         return 0;
3604df
 
21ab4e
@@ -3959,12 +3954,12 @@ dht_setxattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
21ab4e
                 STACK_WIND_COOKIE (frame, dht_file_setxattr_cbk, subvol,
21ab4e
                                    subvol, subvol->fops->setxattr, &local->loc,
21ab4e
                                    local->rebalance.xattr,
21ab4e
-                                   local->rebalance.flags, NULL);
21ab4e
+                                   local->rebalance.flags, local->xattr_req);
3604df
         } else {
21ab4e
                 STACK_WIND_COOKIE (frame, dht_file_setxattr_cbk, subvol,
21ab4e
                                    subvol, subvol->fops->fsetxattr, local->fd,
21ab4e
                                    local->rebalance.xattr,
21ab4e
-                                   local->rebalance.flags, NULL);
21ab4e
+                                   local->rebalance.flags, local->xattr_req);
3604df
         }
3604df
 
3604df
         return 0;
21ab4e
@@ -4239,6 +4234,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
 
21ab4e
@@ -4256,16 +4252,11 @@ 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)
21ab4e
-                        ret = dict_set_int8 (xdata, DHT_IATT_IN_XDATA_KEY, 1);
21ab4e
+                ret = dict_set_int8 (local->xattr_req, DHT_IATT_IN_XDATA_KEY, 1);
21ab4e
 
21ab4e
                 STACK_WIND_COOKIE (frame, dht_file_setxattr_cbk, subvol,
21ab4e
                                    subvol, subvol->fops->setxattr, loc, xattr,
21ab4e
-                                   flags, xdata);
3604df
-
3604df
-                if (xdata)
3604df
-                        dict_unref (xdata);
21ab4e
+                                   flags, local->xattr_req);
3604df
         }
3604df
 
3604df
         return 0;
21ab4e
@@ -4384,11 +4375,11 @@ dht_removexattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame,
3604df
         if (local->fop == GF_FOP_REMOVEXATTR) {
21ab4e
                 STACK_WIND_COOKIE (frame, dht_file_removexattr_cbk, subvol,
21ab4e
                                    subvol, subvol->fops->removexattr,
21ab4e
-                                   &local->loc, local->key, NULL);
21ab4e
+                                   &local->loc, local->key, local->xattr_req);
3604df
         } else {
21ab4e
                 STACK_WIND_COOKIE (frame, dht_file_removexattr_cbk, subvol,
21ab4e
                                    subvol, subvol->fops->fremovexattr,
21ab4e
-                                   local->fd, local->key, NULL);
21ab4e
+                                   local->fd, local->key, local->xattr_req);
3604df
         }
3604df
 
3604df
         return 0;
21ab4e
@@ -4425,8 +4416,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,
21ab4e
@@ -4482,6 +4471,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);
21ab4e
@@ -4492,15 +4482,13 @@ dht_removexattr (call_frame_t *frame, xlator_t *this,
21ab4e
                                            layout->list[i].xlator,
21ab4e
                                            layout->list[i].xlator,
21ab4e
                                            layout->list[i].xlator->fops->removexattr,
21ab4e
-                                           loc, key, NULL);
21ab4e
+                                           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)
21ab4e
-                        ret = dict_set_int8 (xdata, DHT_IATT_IN_XDATA_KEY, 1);
21ab4e
+                ret = dict_set_int8 (local->xattr_req, DHT_IATT_IN_XDATA_KEY, 1);
3604df
                 if (ret) {
3604df
                         gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
3604df
                                 DHT_MSG_DICT_SET_FAILED, "Failed to "
21ab4e
@@ -4510,10 +4498,7 @@ dht_removexattr (call_frame_t *frame, xlator_t *this,
3604df
 
21ab4e
                 STACK_WIND_COOKIE (frame, dht_file_removexattr_cbk, subvol,
21ab4e
                                    subvol, subvol->fops->removexattr, loc, key,
21ab4e
-                                   xdata);
3604df
-
3604df
-                if (xdata)
3604df
-                        dict_unref (xdata);
21ab4e
+                                   local->xattr_req);
3604df
         }
3604df
 
3604df
         return 0;
21ab4e
@@ -6543,7 +6528,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:
21ab4e
@@ -6570,7 +6555,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
 
21ab4e
@@ -6579,7 +6564,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
 }
21ab4e
@@ -6630,6 +6615,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
21ab4e
index 58168de..c53662d 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
 
21ab4e
         STACK_WIND_COOKIE (frame, dht_open_cbk, subvol, subvol,
21ab4e
                            subvol->fops->open, &local->loc,
21ab4e
-                           local->rebalance.flags, local->fd, NULL);
21ab4e
+                           local->rebalance.flags, local->fd, 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;
21ab4e
@@ -239,10 +241,12 @@ dht_attr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
 
3604df
         if (local->fop == GF_FOP_FSTAT) {
21ab4e
                 STACK_WIND_COOKIE (frame, dht_file_attr_cbk, subvol, subvol,
21ab4e
-                                   subvol->fops->fstat, local->fd, NULL);
21ab4e
+                                   subvol->fops->fstat, local->fd,
21ab4e
+                                   local->xattr_req);
3604df
         } else {
21ab4e
                 STACK_WIND_COOKIE (frame, dht_file_attr_cbk, subvol, subvol,
21ab4e
-                                   subvol->fops->stat, &local->loc, NULL);
21ab4e
+                                   subvol->fops->stat, &local->loc,
21ab4e
+                                   local->xattr_req);
3604df
         }
3604df
 
3604df
         return 0;
21ab4e
@@ -325,6 +329,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;
21ab4e
@@ -384,6 +390,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;
21ab4e
@@ -504,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
 
21ab4e
@@ -539,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;
21ab4e
@@ -635,7 +645,7 @@ dht_access2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
 
21ab4e
         STACK_WIND_COOKIE (frame, dht_access_cbk, subvol, subvol,
21ab4e
                            subvol->fops->access, &local->loc,
21ab4e
-                           local->rebalance.flags, NULL);
21ab4e
+                           local->rebalance.flags, local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 
21ab4e
@@ -674,6 +684,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
 
21ab4e
         STACK_WIND_COOKIE (frame, dht_access_cbk, subvol, subvol,
21ab4e
                            subvol->fops->access, loc, mask, xdata);
21ab4e
@@ -708,9 +720,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)) {
21ab4e
@@ -751,7 +760,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
 
21ab4e
@@ -785,6 +794,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
 
21ab4e
@@ -908,7 +919,7 @@ dht_fsync2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
 
21ab4e
         STACK_WIND_COOKIE (frame, dht_fsync_cbk, subvol, subvol,
21ab4e
                            subvol->fops->fsync, local->fd,
21ab4e
-                           local->rebalance.flags, NULL);
21ab4e
+                           local->rebalance.flags, local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 
21ab4e
@@ -935,6 +946,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;
21ab4e
@@ -1025,7 +1038,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
 
21ab4e
@@ -1060,6 +1073,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
21ab4e
index 93755b9..825822a 100644
3604df
--- a/xlators/cluster/dht/src/dht-inode-write.c
3604df
+++ b/xlators/cluster/dht/src/dht-inode-write.c
21ab4e
@@ -144,7 +144,7 @@ dht_writev2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
21ab4e
                            local->fd, local->rebalance.vector,
21ab4e
                            local->rebalance.count,
21ab4e
                            local->rebalance.offset, local->rebalance.flags,
21ab4e
-                           local->rebalance.iobref, NULL);
21ab4e
+                           local->rebalance.iobref, local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 
21ab4e
@@ -181,7 +181,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;
21ab4e
@@ -324,11 +325,11 @@ dht_truncate2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
3604df
         if (local->fop == GF_FOP_TRUNCATE) {
21ab4e
                 STACK_WIND_COOKIE (frame, dht_truncate_cbk, subvol, subvol,
21ab4e
                                    subvol->fops->truncate, &local->loc,
21ab4e
-                                   local->rebalance.offset, NULL);
21ab4e
+                                   local->rebalance.offset, local->xattr_req);
3604df
         } else {
21ab4e
                 STACK_WIND_COOKIE (frame, dht_truncate_cbk, subvol, subvol,
21ab4e
                                    subvol->fops->ftruncate, local->fd,
21ab4e
-                                   local->rebalance.offset, NULL);
21ab4e
+                                   local->rebalance.offset, local->xattr_req);
3604df
         }
3604df
 
3604df
         return 0;
21ab4e
@@ -367,6 +368,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
 
21ab4e
         STACK_WIND_COOKIE (frame, dht_truncate_cbk, subvol, subvol,
21ab4e
                            subvol->fops->truncate, loc, offset, xdata);
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
 
21ab4e
         STACK_WIND_COOKIE (frame, dht_truncate_cbk, subvol, subvol,
21ab4e
                            subvol->fops->ftruncate, fd, offset, xdata);
3604df
@@ -533,7 +538,7 @@ dht_fallocate2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
21ab4e
 	STACK_WIND_COOKIE (frame, dht_fallocate_cbk, subvol, subvol,
21ab4e
                            subvol->fops->fallocate, local->fd,
21ab4e
                            local->rebalance.flags, local->rebalance.offset,
21ab4e
-		           local->rebalance.size, NULL);
21ab4e
+		           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
 
21ab4e
         STACK_WIND_COOKIE (frame, dht_fallocate_cbk, subvol, subvol,
21ab4e
                            subvol->fops->fallocate, fd, mode, offset, len,
21ab4e
@@ -699,7 +706,7 @@ dht_discard2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
21ab4e
 	STACK_WIND_COOKIE (frame, dht_discard_cbk, subvol, subvol,
21ab4e
                            subvol->fops->discard, local->fd,
21ab4e
                            local->rebalance.offset, local->rebalance.size,
21ab4e
-		           NULL);
21ab4e
+		           local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 
21ab4e
@@ -737,6 +744,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
 
21ab4e
         STACK_WIND_COOKIE (frame, dht_discard_cbk, subvol, subvol,
21ab4e
                            subvol->fops->discard, fd, offset, len, xdata);
21ab4e
@@ -863,7 +872,7 @@ dht_zerofill2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
21ab4e
         STACK_WIND_COOKIE (frame, dht_zerofill_cbk, subvol, subvol,
21ab4e
                            subvol->fops->zerofill,
21ab4e
                            local->fd, local->rebalance.offset,
21ab4e
-                           local->rebalance.size, NULL);
21ab4e
+                           local->rebalance.size, local->xattr_req);
3604df
 
3604df
         return 0;
3604df
 
21ab4e
@@ -902,6 +911,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
 
21ab4e
         STACK_WIND_COOKIE (frame, dht_zerofill_cbk, subvol, subvol,
21ab4e
                            subvol->fops->zerofill, fd, offset, len, xdata);
21ab4e
@@ -1006,12 +1017,12 @@ dht_setattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
21ab4e
                 STACK_WIND_COOKIE (frame, dht_file_setattr_cbk, subvol,
21ab4e
                                    subvol, subvol->fops->setattr, &local->loc,
21ab4e
                                    &local->rebalance.stbuf, local->rebalance.flags,
21ab4e
-                                   NULL);
21ab4e
+                                   local->xattr_req);
3604df
         } else {
21ab4e
                 STACK_WIND_COOKIE (frame, dht_file_setattr_cbk, subvol,
21ab4e
                                    subvol, subvol->fops->fsetattr, local->fd,
21ab4e
                                    &local->rebalance.stbuf, local->rebalance.flags,
21ab4e
-                                   NULL);
21ab4e
+                                   local->xattr_req);
3604df
         }
3604df
 
3604df
         return 0;
21ab4e
@@ -1104,6 +1115,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
21ab4e
@@ -1176,6 +1189,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