From 19f9bcff4aada589d4321356c2670ed283f02c03 Mon Sep 17 00:00:00 2001 From: karthik-us Date: Wed, 16 Aug 2017 17:26:48 +0530 Subject: cluster/afr: Fix for arbiter becoming source Problem: When eager-lock is on, and two writes happen in parallel on a FD we were observing the following behaviour: - First write fails on one data brick - Since the post-op is not yet happened, the inode refresh will get both the data bricks as readable and set it in the inode context - In flight split brain check see both the data bricks as readable and allows the second write - Second write fails on the other data brick - Now the post-op happens and marks both the data bricks as bad and arbiter will become source for healing Fix: Adding one more variable called write_suvol in inode context and it will have the in memory representation of the writable subvols. Inode refresh will not update this value and its lifetime is pre-op through unlock in the afr transaction. Initially the pre-op will set this value same as read_subvol in inode context and then in the in flight split brain check we will use this value instead of read_subvol. After all the checks we will update the value of this and set the read_subvol same as this to avoid having incorrect value in that. Change-Id: I2ef6904524ab91af861d59690974bbc529ab1af3 BUG: 1482064 Signed-off-by: karthik-us --- xlators/cluster/afr/src/afr.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'xlators/cluster/afr/src/afr.h') diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 8cd687398f0..b05ec8f6b96 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -838,6 +838,7 @@ typedef struct _afr_local { typedef struct _afr_inode_ctx { uint64_t read_subvol; + uint64_t write_subvol; int spb_choice; gf_timer_t *timer; gf_boolean_t need_refresh; @@ -1265,4 +1266,13 @@ afr_serialize_xattrs_with_delimiter (call_frame_t *frame, xlator_t *this, int32_t *serz_len, char delimiter); gf_boolean_t afr_is_symmetric_error (call_frame_t *frame, xlator_t *this); + +int +__afr_inode_ctx_get (xlator_t *this, inode_t *inode, afr_inode_ctx_t **ctx); + +int +afr_write_subvol_set (call_frame_t *frame, xlator_t *this); + +int +afr_write_subvol_reset (call_frame_t *frame, xlator_t *this); #endif /* __AFR_H__ */ -- cgit