887953
From 07ae526af10de814d174189ff41709cf781ace9c Mon Sep 17 00:00:00 2001
887953
From: Raghavendra Gowdappa <rgowdapp@redhat.com>
887953
Date: Tue, 30 Oct 2018 12:15:35 +0530
887953
Subject: [PATCH 439/444] cluster/dht: fixes to unlinking invalid linkto file
887953
887953
If unlinking of an invalid linkto file failed in lookup-everywhere
887953
codepath, lookup was failed with EIO. The rational as per the comment
887953
was,
887953
887953
<snip>
887953
887953
/* When dht_lookup_everywhere is performed, one cached
887953
  *and one hashed file was found and hashed file does
887953
  *not point to the above mentioned cached node. So it
887953
  *was considered as stale and an unlink was performed.
887953
  *But unlink fails. So may be rebalance is in progress.
887953
  *now ideally we have two data-files. One obtained during
887953
  *lookup_everywhere and one where unlink-failed. So
887953
  *at this point in time we cannot decide which one to
887953
  *choose because there are chances of first cached
887953
  *file is truncated after rebalance and if it is chosen
887953
  *as cached node, application will fail. So return EIO.
887953
*/
887953
887953
</snip>
887953
887953
However, this reasoning is only valid when
887953
* op_errno is EBUSY, indicating rebalance is in progress
887953
* op_errno is ENOTCONN as wecannot determine what was the status of
887953
  file on brick.
887953
887953
Hence this patch doesn't fail lookup unless unlink fails with an
887953
either EBUSY or ENOTCONN
887953
887953
>Change-Id: Ife55f3d97fe557f3db05beae0c2d786df31e8e55
887953
>Fixes: bz#1635145
887953
>Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
887953
887953
Change-Id: Ife55f3d97fe557f3db05beae0c2d786df31e8e55
887953
BUG: 1634649
887953
upstream patch: http://review.gluster.org/r/Ife55f3d97fe557f3db05beae0c2d786df31e8e55
887953
Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
887953
Reviewed-on: https://code.engineering.redhat.com/gerrit/155102
887953
Tested-by: RHGS Build Bot <nigelb@redhat.com>
887953
Reviewed-by: Nithya Balachandran <nbalacha@redhat.com>
887953
---
887953
 xlators/cluster/dht/src/dht-common.c | 7 +++----
887953
 1 file changed, 3 insertions(+), 4 deletions(-)
887953
887953
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
887953
index 0984f8f..d3a0c8b 100644
887953
--- a/xlators/cluster/dht/src/dht-common.c
887953
+++ b/xlators/cluster/dht/src/dht-common.c
887953
@@ -2104,10 +2104,9 @@ dht_lookup_unlink_of_false_linkto_cbk (call_frame_t *frame, void *cookie,
887953
 
887953
         this_call_cnt = dht_frame_return (frame);
887953
         if (is_last_call (this_call_cnt)) {
887953
-
887953
-                if (op_ret == 0) {
887953
-                        dht_lookup_everywhere_done (frame, this);
887953
-                } else {
887953
+          if ((op_ret == 0) || ((op_errno != EBUSY) && (op_errno != ENOTCONN))) {
887953
+            dht_lookup_everywhere_done (frame, this);
887953
+          } else {
887953
                        /*When dht_lookup_everywhere is performed, one cached
887953
                          *and one hashed file was found and hashed file does
887953
                          *not point to the above mentioned cached node. So it
887953
-- 
887953
1.8.3.1
887953