3604df
From f1712395a255656dc57f1ebb095001d084cbec79 Mon Sep 17 00:00:00 2001
3604df
From: Krutika Dhananjay <kdhananj@redhat.com>
3604df
Date: Thu, 27 Apr 2017 11:53:24 +0530
3604df
Subject: [PATCH 314/316] cluster/dht: Pass the correct xdata in fremovexattr
3604df
 fop
3604df
3604df
        Backport of: https://review.gluster.org/17126
3604df
3604df
Change-Id: Ibcb50dbccaab9b8b965dc92e771a5252942f0578
3604df
BUG: 1439753
3604df
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/105198
3604df
Reviewed-by: Nithya Balachandran <nbalacha@redhat.com>
3604df
---
3604df
 xlators/cluster/dht/src/dht-common.c | 15 +++++----------
3604df
 1 file changed, 5 insertions(+), 10 deletions(-)
3604df
3604df
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
3604df
index 93bb2ad..8317cc0 100644
3604df
--- a/xlators/cluster/dht/src/dht-common.c
3604df
+++ b/xlators/cluster/dht/src/dht-common.c
3604df
@@ -4361,6 +4361,7 @@ dht_fremovexattr (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
@@ -4370,29 +4371,23 @@ dht_fremovexattr (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->fremovexattr,
3604df
-                                    fd, key, NULL);
3604df
+                                    fd, 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
+                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
                                 "set dictionary key %s for fd=%p",
3604df
                                 DHT_IATT_IN_XDATA_KEY, fd);
3604df
                 }
3604df
-
3604df
                 STACK_WIND (frame, dht_file_removexattr_cbk,
3604df
                             subvol, subvol->fops->fremovexattr,
3604df
-                            fd, key, xdata);
3604df
-
3604df
-                if (xdata)
3604df
-                        dict_unref (xdata);
3604df
+                            fd, key, local->xattr_req);
3604df
         }
3604df
 
3604df
         return 0;
3604df
-- 
3604df
1.8.3.1
3604df