From 6c578c03f0d44913d264494de5df004544c96271 Mon Sep 17 00:00:00 2001 From: Anuradha Date: Thu, 30 Apr 2015 15:31:13 +0530 Subject: cluster/afr : Prevent inode-evict during split-brain resolution 1) Provided setfattr command to set timeout for split-brain choice. 2) If split-brain inspection/resolution is being done from the mount for a file, ref the inode when split-brain-choice is set. This inode will be unconditionally unref-ed after timeout seconds set by the user/default otherwise. 3) Updated the doc and testcase to reflect the changes. Change-Id: I15c9037dee28855f21e680e7e3632e1f48dba4e1 BUG: 1209104 Signed-off-by: Anuradha Reviewed-on: http://review.gluster.org/10134 Reviewed-by: Krutika Dhananjay Reviewed-by: Ravishankar N Tested-by: Gluster Build System Tested-by: NetBSD Build System Reviewed-by: Pranith Kumar Karampuri --- xlators/cluster/afr/src/afr.h | 20 ++++++++++++++++++++ 1 file changed, 20 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 6cb708ffbd7..855d3a3680e 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -38,6 +38,7 @@ #define AFR_LOCKEE_COUNT_MAX 3 #define AFR_DOM_COUNT_MAX 3 #define AFR_NUM_CHANGE_LOGS 3 /*data + metadata + entry*/ +#define AFR_DEFAULT_SPB_CHOICE_TIMEOUT 300 /*in seconds*/ #define ARBITER_BRICK_INDEX 2 @@ -130,6 +131,7 @@ typedef struct _afr_private { void *pump_private; gf_boolean_t use_afr_in_pump; gf_boolean_t consistent_metadata; + uint64_t spb_choice_timeout; } afr_private_t; @@ -742,8 +744,17 @@ typedef struct _afr_local { typedef struct _afr_inode_ctx { uint64_t read_subvol; int spb_choice; + gf_timer_t *timer; } afr_inode_ctx_t; +typedef struct afr_spbc_timeout { + call_frame_t *frame; + gf_boolean_t d_spb; + gf_boolean_t m_spb; + loc_t *loc; + int spb_child_index; +} afr_spbc_timeout_t; + /* did a call fail due to a child failing? */ #define child_went_down(op_ret, op_errno) (((op_ret) < 0) && \ ((op_errno == ENOTCONN) || \ @@ -1046,4 +1057,13 @@ afr_inode_split_brain_choice_get (inode_t *inode, xlator_t *this, int *spb_choice); int afr_get_child_index_from_name (xlator_t *this, char *name); + +int +afr_is_split_brain (call_frame_t *frame, xlator_t *this, inode_t *inode, + uuid_t gfid, gf_boolean_t *d_spb, gf_boolean_t *m_spb); +int +afr_spb_choice_timeout_cancel (xlator_t *this, inode_t *inode); + +int +afr_set_split_brain_choice (int ret, call_frame_t *frame, void *opaque); #endif /* __AFR_H__ */ -- cgit