diff options
author | Pavan Sondur <pavan@gluster.com> | 2010-05-24 11:43:57 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-05-31 05:39:33 -0700 |
commit | f26c5070b0df1bdc4c3bb238b0a938fa2c0f6ffd (patch) | |
tree | 67445b2acd9f991553969a1d1c6fa71ecc0aa8af /xlators/cluster | |
parent | 88229e48f80aebb897cee1c1aeca36c6826e148f (diff) |
cluster/afr: Handle open-fds of unlinked files during a possible self heal gracefully.
Do not try to self heal open fds if inode_path fails and try and
continue the write transaction.
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 803 ([3.0.4rc2] Crash in afr_up_down_flush_post_post_op)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=803
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/afr/src/afr-open.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-open.c b/xlators/cluster/afr/src/afr-open.c index ae58eef0616..43a38c0b112 100644 --- a/xlators/cluster/afr/src/afr-open.c +++ b/xlators/cluster/afr/src/afr-open.c @@ -321,6 +321,11 @@ afr_up_down_flush_sh_unwind (call_frame_t *frame, xlator_t *this) local->call_count = call_count; + if (!local->loc.path) { + abandon = 1; + goto out; + } + for (i = 0; i < priv->child_count; i++) { if (!fd_ctx->opened_on[i] && local->child_up[i]) { gf_log (this->name, GF_LOG_TRACE, @@ -354,11 +359,20 @@ afr_up_down_flush_post_post_op (call_frame_t *frame, xlator_t *this) afr_local_t *local = NULL; afr_self_heal_t *sh = NULL; + int ret = -1; + priv = this->private; local = frame->local; sh = &local->self_heal; - inode_path (local->fd->inode, NULL, (char **)&local->loc.path); + ret = inode_path (local->fd->inode, NULL, (char **)&local->loc.path); + if (ret < 0) { + gf_log (this->name, GF_LOG_TRACE, + "Inode path failed. Possible open-unlink-write detected"); + afr_up_down_flush_sh_unwind (frame, this); + + return 0; + } local->loc.name = strrchr (local->loc.path, '/'); local->loc.inode = inode_ref (local->fd->inode); local->loc.parent = inode_parent (local->fd->inode, 0, NULL); |