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