e7a346
From 1bcb5bbd42a4187ed385853f0364a3941bea9846 Mon Sep 17 00:00:00 2001
e7a346
From: karthik-us <ksubrahm@redhat.com>
e7a346
Date: Fri, 17 Nov 2017 17:29:36 +0530
e7a346
Subject: [PATCH 078/128] cluster/afr: Honor default timeout of 5min for
e7a346
 analyzing split-brain files
e7a346
e7a346
Problem:
e7a346
After setting split-brain-choice option to analyze the file to resolve
e7a346
the split brain using the command
e7a346
"setfattr -n replica.split-brain-choice -v "choiceX" <path-to-file>"
e7a346
should allow to access the file from mount for default timeout of 5mins.
e7a346
But the timeout was not honored and was able to access the file even after
e7a346
the timeout.
e7a346
e7a346
Fix:
e7a346
Call the inode_invalidate() in afr_set_split_brain_choice_cbk() so that
e7a346
it will triger the cache invalidate after resetting the timer and the
e7a346
split brain choice. So the next calls to access the file will fail with EIO.
e7a346
e7a346
Upstream patch: https://review.gluster.org/#/c/18546/
e7a346
e7a346
> Change-Id: I698cb833676b22ff3e4c6daf8b883a0958f51a64
e7a346
> BUG: 1503519
e7a346
> Signed-off-by: karthik-us <ksubrahm@redhat.com>
e7a346
e7a346
Change-Id: I698cb833676b22ff3e4c6daf8b883a0958f51a64
e7a346
BUG: 1360331
e7a346
Signed-off-by: karthik-us <ksubrahm@redhat.com>
e7a346
Reviewed-on: https://code.engineering.redhat.com/gerrit/123560
e7a346
Tested-by: RHGS Build Bot <nigelb@redhat.com>
e7a346
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
e7a346
---
e7a346
 xlators/cluster/afr/src/afr-common.c | 6 +++++-
e7a346
 1 file changed, 5 insertions(+), 1 deletion(-)
e7a346
e7a346
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
e7a346
index 2925a1d..9c96056 100644
e7a346
--- a/xlators/cluster/afr/src/afr-common.c
e7a346
+++ b/xlators/cluster/afr/src/afr-common.c
e7a346
@@ -730,6 +730,7 @@ afr_set_split_brain_choice_cbk (void *data)
e7a346
         xlator_t     *this      = THIS;
e7a346
 
e7a346
         afr_spb_choice_timeout_cancel (this, inode);
e7a346
+        inode_invalidate (inode);
e7a346
         inode_unref (inode);
e7a346
         return;
e7a346
 }
e7a346
@@ -749,6 +750,7 @@ afr_set_split_brain_choice (int ret, call_frame_t *frame, void *opaque)
e7a346
         gf_boolean_t        timer_set        = _gf_false;
e7a346
         gf_boolean_t        timer_cancelled  = _gf_false;
e7a346
         gf_boolean_t        timer_reset      = _gf_false;
e7a346
+        gf_boolean_t        need_invalidate  = _gf_true;
e7a346
         int                 old_spb_choice   = -1;
e7a346
 
e7a346
         frame = data->frame;
e7a346
@@ -861,6 +863,7 @@ set_timer:
e7a346
                         timer_set = _gf_true;
e7a346
                 if (timer_reset && !ctx->timer)
e7a346
                         timer_cancelled = _gf_true;
e7a346
+                need_invalidate = _gf_false;
e7a346
         }
e7a346
 unlock:
e7a346
         UNLOCK(&inode->lock);
e7a346
@@ -873,7 +876,8 @@ unlock:
e7a346
          * reads from an older cached value despite a change in spb_choice to
e7a346
          * a new value.
e7a346
          */
e7a346
-        inode_invalidate (inode);
e7a346
+        if (need_invalidate)
e7a346
+                inode_invalidate (inode);
e7a346
 out:
e7a346
         if (data)
e7a346
                 GF_FREE (data);
e7a346
-- 
e7a346
1.8.3.1
e7a346