Blob Blame History Raw
From 07ae526af10de814d174189ff41709cf781ace9c Mon Sep 17 00:00:00 2001
From: Raghavendra Gowdappa <rgowdapp@redhat.com>
Date: Tue, 30 Oct 2018 12:15:35 +0530
Subject: [PATCH 439/444] cluster/dht: fixes to unlinking invalid linkto file

If unlinking of an invalid linkto file failed in lookup-everywhere
codepath, lookup was failed with EIO. The rational as per the comment
was,

<snip>

/* When dht_lookup_everywhere is performed, one cached
  *and one hashed file was found and hashed file does
  *not point to the above mentioned cached node. So it
  *was considered as stale and an unlink was performed.
  *But unlink fails. So may be rebalance is in progress.
  *now ideally we have two data-files. One obtained during
  *lookup_everywhere and one where unlink-failed. So
  *at this point in time we cannot decide which one to
  *choose because there are chances of first cached
  *file is truncated after rebalance and if it is chosen
  *as cached node, application will fail. So return EIO.
*/

</snip>

However, this reasoning is only valid when
* op_errno is EBUSY, indicating rebalance is in progress
* op_errno is ENOTCONN as wecannot determine what was the status of
  file on brick.

Hence this patch doesn't fail lookup unless unlink fails with an
either EBUSY or ENOTCONN

>Change-Id: Ife55f3d97fe557f3db05beae0c2d786df31e8e55
>Fixes: bz#1635145
>Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com>

Change-Id: Ife55f3d97fe557f3db05beae0c2d786df31e8e55
BUG: 1634649
upstream patch: http://review.gluster.org/r/Ife55f3d97fe557f3db05beae0c2d786df31e8e55
Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/155102
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Nithya Balachandran <nbalacha@redhat.com>
---
 xlators/cluster/dht/src/dht-common.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 0984f8f..d3a0c8b 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -2104,10 +2104,9 @@ dht_lookup_unlink_of_false_linkto_cbk (call_frame_t *frame, void *cookie,
 
         this_call_cnt = dht_frame_return (frame);
         if (is_last_call (this_call_cnt)) {
-
-                if (op_ret == 0) {
-                        dht_lookup_everywhere_done (frame, this);
-                } else {
+          if ((op_ret == 0) || ((op_errno != EBUSY) && (op_errno != ENOTCONN))) {
+            dht_lookup_everywhere_done (frame, this);
+          } else {
                        /*When dht_lookup_everywhere is performed, one cached
                          *and one hashed file was found and hashed file does
                          *not point to the above mentioned cached node. So it
-- 
1.8.3.1