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