From 00b0a53bae2a5e39f197359581a3850a32970e54 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Thu, 28 Oct 2010 00:52:30 +0000 Subject: replicate: fix hang/missing frame during locking nonblocking style locking would result in a missing frame when all subvolumes are down or when no subvolume on which fd was opened is up. Check for this condition and unlock gracefully Signed-off-by: Anand V. Avati Signed-off-by: Anand V. Avati BUG: 918 (AFR write fails when subvolumes' state is swapped) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=918 --- xlators/cluster/afr/src/afr-lk-common.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/xlators/cluster/afr/src/afr-lk-common.c b/xlators/cluster/afr/src/afr-lk-common.c index e7eb6a12e64..c8b0b66009e 100644 --- a/xlators/cluster/afr/src/afr-lk-common.c +++ b/xlators/cluster/afr/src/afr-lk-common.c @@ -1236,6 +1236,13 @@ afr_nonblocking_entrylk (call_frame_t *frame, xlator_t *this) call_count = internal_lock_count (frame, this, fd_ctx); int_lock->lk_call_count = call_count; + if (!call_count) { + gf_log (this->name, GF_LOG_DEBUG, + "fd not open on any subvolumes. aborting."); + afr_unlock (frame, this); + goto out; + } + /* Send non-blocking entrylk calls only on up children and where the fd has been opened */ for (i = 0; i < priv->child_count; i++) { @@ -1276,7 +1283,7 @@ afr_nonblocking_entrylk (call_frame_t *frame, xlator_t *this) } } } - +out: return 0; } @@ -1394,6 +1401,13 @@ afr_nonblocking_inodelk (call_frame_t *frame, xlator_t *this) call_count = internal_lock_count (frame, this, fd_ctx); int_lock->lk_call_count = call_count; + if (!call_count) { + gf_log (this->name, GF_LOG_DEBUG, + "fd not open on any subvolumes. aborting."); + afr_unlock (frame, this); + goto out; + } + /* Send non-blocking inodelk calls only on up children and where the fd has been opened */ for (i = 0; i < priv->child_count; i++) { -- cgit