From d38b2217393c460937505f30bd61576e7957f877 Mon Sep 17 00:00:00 2001 From: Pavan Sondur Date: Mon, 6 Sep 2010 09:01:24 +0000 Subject: cluster/afr: Fix hang in create when one subvol is down. Signed-off-by: Pavan Vilas Sondur Signed-off-by: Vijay Bellur BUG: 1544 (Create fails when 1 server is down) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1544 --- xlators/cluster/afr/src/afr-dir-read.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'xlators/cluster/afr/src/afr-dir-read.c') diff --git a/xlators/cluster/afr/src/afr-dir-read.c b/xlators/cluster/afr/src/afr-dir-read.c index a6b13f7c9..1f29cc006 100644 --- a/xlators/cluster/afr/src/afr-dir-read.c +++ b/xlators/cluster/afr/src/afr-dir-read.c @@ -226,14 +226,20 @@ afr_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd) { - afr_local_t * local = NULL; + afr_private_t *priv = NULL; + afr_local_t *local = NULL; + int32_t up_children_count = 0; int call_count = -1; + priv = this->private; + local = frame->local; + + up_children_count = afr_up_children_count (priv->child_count, + local->child_up); + LOCK (&frame->lock); { - local = frame->local; - if (op_ret >= 0) local->op_ret = op_ret; @@ -247,7 +253,8 @@ afr_opendir_cbk (call_frame_t *frame, void *cookie, if (local->op_ret == 0) { afr_fd_ctx_set (this, local->fd); - if (!afr_is_opendir_done (this, local->fd->inode)) { + if (!afr_is_opendir_done (this, local->fd->inode) && + up_children_count > 1) { /* * This is the first opendir on this inode. We need -- cgit