From f26c5070b0df1bdc4c3bb238b0a938fa2c0f6ffd Mon Sep 17 00:00:00 2001 From: Pavan Sondur Date: Mon, 24 May 2010 11:43:57 +0000 Subject: 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 Signed-off-by: Anand V. Avati 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 --- xlators/cluster/afr/src/afr-open.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'xlators') 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); -- cgit