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