summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkarthik-us <ksubrahm@redhat.com>2017-10-18 16:43:16 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2017-11-27 13:50:23 +0000
commitcccf80cade09efca5f5e56a8e971251d6eb5adfe (patch)
tree14eaa2eefbe848e5cc2a8b6eb9f0f470df05582b
parent0c59a33f13dac76e439f9b6f540974de2d0481df (diff)
cluster/afr: Honor default timeout of 5min for analyzing split-brain files
Problem: After setting split-brain-choice option to analyze the file to resolve the split brain using the command "setfattr -n replica.split-brain-choice -v "choiceX" <path-to-file>" should allow to access the file from mount for default timeout of 5mins. But the timeout was not honored and was able to access the file even after the timeout. Fix: Call the inode_invalidate() in afr_set_split_brain_choice_cbk() so that it will triger the cache invalidate after resetting the timer and the split brain choice. So the next calls to access the file will fail with EIO. Change-Id: I698cb833676b22ff3e4c6daf8b883a0958f51a64 BUG: 1514388 Signed-off-by: karthik-us <ksubrahm@redhat.com> (cherry picked from commit 933ec57ccda2c1ba5ce6f207313c3b6802e67ca3)
-rw-r--r--xlators/cluster/afr/src/afr-common.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 73550befc23..45ffa69781a 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -730,6 +730,7 @@ afr_set_split_brain_choice_cbk (void *data)
xlator_t *this = THIS;
afr_spb_choice_timeout_cancel (this, inode);
+ inode_invalidate (inode);
inode_unref (inode);
return;
}
@@ -749,6 +750,7 @@ afr_set_split_brain_choice (int ret, call_frame_t *frame, void *opaque)
gf_boolean_t timer_set = _gf_false;
gf_boolean_t timer_cancelled = _gf_false;
gf_boolean_t timer_reset = _gf_false;
+ gf_boolean_t need_invalidate = _gf_true;
int old_spb_choice = -1;
frame = data->frame;
@@ -861,6 +863,7 @@ set_timer:
timer_set = _gf_true;
if (timer_reset && !ctx->timer)
timer_cancelled = _gf_true;
+ need_invalidate = _gf_false;
}
unlock:
UNLOCK(&inode->lock);
@@ -873,7 +876,8 @@ unlock:
* reads from an older cached value despite a change in spb_choice to
* a new value.
*/
- inode_invalidate (inode);
+ if (need_invalidate)
+ inode_invalidate (inode);
out:
if (data)
GF_FREE (data);