From 1719cffa911c5287715abfdb991bc8862f0c994e Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Thu, 14 Sep 2017 11:29:15 +0530 Subject: afr: auto-resolve split-brains for zero-byte files Problems: As described in BZ 1491670, renaming hardlinks can result in data/mdata split-brain of the DHT link-to files (T files) without any mismatch of data and metadata. As described in BZ 1486063, for a zero-byte file with only dirty bits set, arbiter brick will likely be chosen as the source brick. Fix: For zero byte files in split-brain, pick first brick as a) data source if file size is zero on all bricks. b) metadata source if metadata is the same on all bricks In arbiter case, if file size is zero on all bricks and there are no pending afr xattrs, pick 1st brick as data source. Change-Id: I0270a9a2f97c3b21087e280bb890159b43975e04 BUG: 1491670 Signed-off-by: Ravishankar N Reported-by: Rahul Hinduja Reported-by: Mabi --- xlators/cluster/afr/src/afr-self-heal-data.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'xlators/cluster/afr/src/afr-self-heal-data.c') diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 13679608dfd..2c254e80aa1 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -581,6 +581,12 @@ __afr_selfheal_data_finalize_source (call_frame_t *frame, xlator_t *this, afr_mark_largest_file_as_source (this, sources, replies); afr_mark_biggest_witness_as_source (this, sources, witness); afr_mark_newest_file_as_source (this, sources, replies); + if (priv->arbiter_count) + /* Choose non-arbiter brick as source for empty files. */ + afr_mark_source_sinks_if_file_empty (this, sources, sinks, + healed_sinks, locked_on, + replies, + AFR_DATA_TRANSACTION); out: afr_mark_active_sinks (this, sources, locked_on, healed_sinks); -- cgit