diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2012-07-18 10:28:18 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-08-12 21:51:39 -0700 |
commit | 12aa31278c651f36c2ea1c0698ba789aa3f9262c (patch) | |
tree | 21642a29f8456553dea1c0ca26feda431c850ff4 /xlators/cluster/afr/src/afr-self-heal-metadata.c | |
parent | aa4e7d04ff20e38182a62576595951d59524fff0 (diff) |
cluster/afr: Avoid setting split-brain outside inode locks
RCA:
The bug is observed because the decision to mark
a file in split-brain is taken outside appropriate locks.
Lookup gathers xattrs outside any lock. The xattrs being
in split-brain in lookup should only be taken as a hint.
Appropriate inodelks should be taken before confirming
a split-brain. Self-heal confirms this at the moment.
Fix:
Self-heals are launched to inspect xattrs when the
data/metadata self-heal options are turned on.
Decision to set/reset split-brain flag is taken inside
appropriate locks.
Known Issue After fix:
If data/metadata self-heal is turned off, inspecting of
xattrs could not be performed so split-brain behavior
does not work correctly if the self-heal options are turned off.
This bug is handled only in upstream.
Change-Id: I59a43d5ce7bf9ca35bff54a51bf4cfa55d717a9e
BUG: 833727
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3691
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-metadata.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-metadata.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c index 79718315c..6c3989e84 100644 --- a/xlators/cluster/afr/src/afr-self-heal-metadata.c +++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c @@ -50,7 +50,7 @@ afr_sh_metadata_done (call_frame_t *frame, xlator_t *this) sh = &local->self_heal; afr_sh_reset (frame, this); - if (local->govinda_gOvinda) { + if (sh->mdata_spb) { gf_log (this->name, GF_LOG_INFO, "split-brain detected, aborting selfheal of %s", local->loc.path); @@ -450,15 +450,6 @@ afr_sh_metadata_fix (call_frame_t *frame, xlator_t *this, sh->pending_matrix, sh->sources, sh->success_children, AFR_METADATA_TRANSACTION, NULL, _gf_false); - if (nsources == 0) { - gf_log (this->name, GF_LOG_TRACE, - "No self-heal needed for %s", - local->loc.path); - - afr_sh_metadata_finish (frame, this); - goto out; - } - if ((nsources == -1) && (priv->favorite_child != -1) && (sh->child_errno[priv->favorite_child] == 0)) { @@ -480,7 +471,16 @@ afr_sh_metadata_fix (call_frame_t *frame, xlator_t *this, "(possible split-brain). Please fix the file on " "all backend volumes", local->loc.path); - local->govinda_gOvinda = 1; + sh->mdata_spb = _gf_true; + + afr_sh_metadata_finish (frame, this); + goto out; + } + sh->mdata_spb = _gf_false; + if (nsources == 0) { + gf_log (this->name, GF_LOG_TRACE, + "No self-heal needed for %s", + local->loc.path); afr_sh_metadata_finish (frame, this); goto out; @@ -584,10 +584,19 @@ int afr_self_heal_metadata (call_frame_t *frame, xlator_t *this) { afr_local_t *local = NULL; + afr_self_heal_t *sh = NULL; afr_private_t *priv = this->private; - local = frame->local; + sh = &local->self_heal; + + /* Self-heal completion cbk changes inode split-brain status based on + * govinda_gOvinda, mdata_spb, data_spb values. Initialize mdata_spb + * with current split-brain status. If for some reason self-heal + * fails(locking phase etc), it makes sure we retain the split-brain + * status before this self-heal started. + */ + sh->mdata_spb = afr_is_split_brain (this, sh->inode); if (local->self_heal.do_metadata_self_heal && priv->metadata_self_heal) { afr_sh_metadata_lock (frame, this); |