diff options
author | Anand Avati <avati@gluster.com> | 2010-10-28 00:52:30 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-10-27 23:37:36 -0700 |
commit | 00b0a53bae2a5e39f197359581a3850a32970e54 (patch) | |
tree | 4cb60e938cec6bcbbf9ad278fad32be41ec349fd /xlators | |
parent | 87c0e8fba2d0be4496ec4085136fca459f62c00c (diff) |
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 <avati@blackhole.gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 918 (AFR write fails when subvolumes' state is swapped)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=918
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/afr/src/afr-lk-common.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-lk-common.c b/xlators/cluster/afr/src/afr-lk-common.c index e7eb6a12e..c8b0b6600 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++) { |