diff options
author | Anand Avati <avati@gluster.com> | 2009-10-13 06:42:50 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-10-13 05:46:55 -0700 |
commit | f512ee469bd690f65e388f565b69e2395e43a4aa (patch) | |
tree | 7743b1ab150feb511f07d23c1bacbef541e02f87 /xlators/cluster/afr/src/afr-self-heal-entry.c | |
parent | 92a5fd621db0949637bb37e698709271e13610df (diff) |
prevent spurious unlocks from afr selfheal
afr selfheal now remembers all the nodes on which locks were successfully
held and sends unlocks only to those nodes
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 112 (parallel deletion of files mounted by different clients on the same back-end hangs and/or does not completely delete)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=112
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-entry.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-entry.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c index f3759b113a4..676f2ef1b31 100644 --- a/xlators/cluster/afr/src/afr-self-heal-entry.c +++ b/xlators/cluster/afr/src/afr-self-heal-entry.c @@ -56,6 +56,7 @@ afr_sh_entry_done (call_frame_t *frame, xlator_t *this) afr_local_t *local = NULL; afr_self_heal_t *sh = NULL; afr_private_t *priv = NULL; + int i = 0; local = frame->local; sh = &local->self_heal; @@ -65,6 +66,14 @@ afr_sh_entry_done (call_frame_t *frame, xlator_t *this) TODO: cleanup sh->* */ + if (sh->healing_fd) + fd_unref (sh->healing_fd); + sh->healing_fd = NULL; + + for (i = 0; i < priv->child_count; i++) { + sh->locked_nodes[i] = 0; + } + gf_log (this->name, GF_LOG_TRACE, "self heal of %s completed", local->loc.path); @@ -107,9 +116,6 @@ afr_sh_entry_unlck_cbk (call_frame_t *frame, void *cookie, xlator_t *this, call_count = afr_frame_return (frame); if (call_count == 0) { - if (sh->healing_fd) - fd_unref (sh->healing_fd); - sh->healing_fd = NULL; afr_sh_entry_done (frame, this); } @@ -132,12 +138,20 @@ afr_sh_entry_unlock (call_frame_t *frame, xlator_t *this) sh = &local->self_heal; priv = this->private; - call_count = local->child_count; + for (i = 0; i < priv->child_count; i++) { + if (sh->locked_nodes[i]) + call_count++; + } + + if (call_count == 0) { + afr_sh_entry_done (frame, this); + return 0; + } local->call_count = call_count; for (i = 0; i < priv->child_count; i++) { - if (local->child_up[i]) { + if (sh->locked_nodes[i]) { gf_log (this->name, GF_LOG_TRACE, "unlocking %s on subvolume %s", local->loc.path, priv->children[i]->name); @@ -2013,11 +2027,13 @@ afr_sh_entry_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) { sh->op_failed = 1; + sh->locked_nodes[child_index] = 0; gf_log (this->name, GF_LOG_DEBUG, "locking inode of %s on child %d failed: %s", local->loc.path, child_index, strerror (op_errno)); } else { + sh->locked_nodes[child_index] = 1; gf_log (this->name, GF_LOG_TRACE, "inode of %s on child %d locked", local->loc.path, child_index); |