a3470f
From c5401605f80c2630e39b283f10b7da92ff777863 Mon Sep 17 00:00:00 2001
a3470f
From: Susant Palai <spalai@redhat.com>
a3470f
Date: Fri, 27 Apr 2018 16:40:02 +0530
a3470f
Subject: [PATCH 251/260] dht: gf_defrag_settle_hash should ignore ENOENT and
a3470f
 ESTALE error
a3470f
a3470f
Problem: A directory deletion can happen just before gf_defrag_settle_hash
a3470f
which internally does a setxattr operation on a directory.
a3470f
a3470f
Solution: Ignore ENOENT and ESTALE errors
a3470f
a3470f
> Fixes: bz#1572581
a3470f
> Change-Id: I2f91809f3b5e02976c4c3a5a596406a8b2f8f6f2
a3470f
> Signed-off-by: Susant Palai <spalai@redhat.com>
a3470f
(cherry picked from commit e2fda098112803bf651c4795952376cb8c1ad204)
a3470f
a3470f
upstream patch: https://review.gluster.org/#/c/19945/
a3470f
a3470f
BUG: 1572585
a3470f
Change-Id: I2f91809f3b5e02976c4c3a5a596406a8b2f8f6f2
a3470f
Signed-off-by: Susant Palai <spalai@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/137527
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
Reviewed-by: Nithya Balachandran <nbalacha@redhat.com>
a3470f
---
a3470f
 xlators/cluster/dht/src/dht-rebalance.c | 9 ++++++++-
a3470f
 1 file changed, 8 insertions(+), 1 deletion(-)
a3470f
a3470f
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
a3470f
index eee00b8..51af11c 100644
a3470f
--- a/xlators/cluster/dht/src/dht-rebalance.c
a3470f
+++ b/xlators/cluster/dht/src/dht-rebalance.c
a3470f
@@ -3493,8 +3493,15 @@ gf_defrag_settle_hash (xlator_t *this, gf_defrag_info_t *defrag,
a3470f
 
a3470f
         ret = syncop_setxattr (this, loc, fix_layout, 0, NULL, NULL);
a3470f
         if (ret) {
a3470f
-                gf_log (this->name, GF_LOG_ERROR,
a3470f
+                gf_msg (this->name, GF_LOG_ERROR, -ret,
a3470f
+                        DHT_MSG_LAYOUT_FIX_FAILED,
a3470f
                         "fix layout on %s failed", loc->path);
a3470f
+
a3470f
+                if (-ret == ENOENT || -ret == ESTALE) {
a3470f
+                        /* Dir most likely is deleted */
a3470f
+                        return 0;
a3470f
+                }
a3470f
+
a3470f
                 return -1;
a3470f
         }
a3470f
 
a3470f
-- 
a3470f
1.8.3.1
a3470f