21ab4e
From 3ab8e2501acab87420e68adfaae910aa5d97936f Mon Sep 17 00:00:00 2001
21ab4e
From: N Balachandran <nbalacha@redhat.com>
21ab4e
Date: Mon, 13 Feb 2017 16:49:06 +0530
21ab4e
Subject: [PATCH 335/361] cluster/dht Fix error assignment in dht_*xattr2
21ab4e
 functions
21ab4e
21ab4e
Corrected the op_errno assignments and NULL checks in
21ab4e
the dht_sexattr2 and dht_removexattr2 functions. Earlier,
21ab4e
they unwound with the default EINVAL op_errno if the
21ab4e
file had been deleted.
21ab4e
21ab4e
mainline:
21ab4e
> BUG: 1421653
21ab4e
> Reviewed-on: https://review.gluster.org/16610
21ab4e
> Smoke: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
21ab4e
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> Reviewed-by: MOHIT AGRAWAL <moagrawa@redhat.com>
21ab4e
> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
21ab4e
(cherry picked from commit c54ea9b58c1fad4de85eb1a573058d86355670da)
21ab4e
21ab4e
BUG: 1425697
21ab4e
Change-Id: Iaf837a473d769cea40132487a966c7f452990071
21ab4e
Signed-off-by: N Balachandran <nbalacha@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/101316
21ab4e
Tested-by: Milind Changire <mchangir@redhat.com>
21ab4e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
---
21ab4e
 xlators/cluster/dht/src/dht-common.c | 8 ++++++--
21ab4e
 1 file changed, 6 insertions(+), 2 deletions(-)
21ab4e
21ab4e
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
21ab4e
index 4907931..e40805a 100644
21ab4e
--- a/xlators/cluster/dht/src/dht-common.c
21ab4e
+++ b/xlators/cluster/dht/src/dht-common.c
21ab4e
@@ -3929,6 +3929,7 @@ dht_setxattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
21ab4e
                 goto err;
21ab4e
 
21ab4e
         local = frame->local;
21ab4e
+        op_errno = local->op_errno;
21ab4e
 
21ab4e
         if (we_are_not_migrating (ret)) {
21ab4e
                 /* This dht xlator is not migrating the file. Unwind and
21ab4e
@@ -3943,7 +3944,6 @@ dht_setxattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
21ab4e
         if (subvol == NULL)
21ab4e
                 goto err;
21ab4e
 
21ab4e
-        op_errno = local->op_errno;
21ab4e
 
21ab4e
         local->call_cnt = 2; /* This is the second attempt */
21ab4e
 
21ab4e
@@ -4351,10 +4351,11 @@ dht_removexattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame,
21ab4e
         dht_local_t *local    = NULL;
21ab4e
         int          op_errno = EINVAL;
21ab4e
 
21ab4e
-        if (!frame || !frame->local || !subvol)
21ab4e
+        if (!frame || !frame->local)
21ab4e
                 goto err;
21ab4e
 
21ab4e
         local = frame->local;
21ab4e
+        op_errno = local->op_errno;
21ab4e
 
21ab4e
         local->call_cnt = 2; /* This is the second attempt */
21ab4e
 
21ab4e
@@ -4369,6 +4370,9 @@ dht_removexattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame,
21ab4e
                 return 0;
21ab4e
         }
21ab4e
 
21ab4e
+        if (subvol == NULL)
21ab4e
+                goto err;
21ab4e
+
21ab4e
         if (local->fop == GF_FOP_REMOVEXATTR) {
21ab4e
                 STACK_WIND (frame, dht_file_removexattr_cbk, subvol,
21ab4e
                             subvol->fops->removexattr, &local->loc,
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e