From 5cbc81a8d32434ff0c3e104ec802bcdc8c582f20 Mon Sep 17 00:00:00 2001 From: Pavan Sondur Date: Thu, 21 Oct 2010 06:56:06 +0000 Subject: cluster/afr: Do a broadcast unlock in replicate to eliminate deadlock during upgrade/downgrade. Signed-off-by: Pavan Vilas Sondur Signed-off-by: Vijay Bellur BUG: 1017 (Locking deadlock when upgrading lock) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1017 --- xlators/features/locks/src/common.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'xlators/features/locks') diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c index 483d7bf57fc..9b712bb32bb 100644 --- a/xlators/features/locks/src/common.c +++ b/xlators/features/locks/src/common.c @@ -923,17 +923,17 @@ pl_setlk (xlator_t *this, pl_inode_t *pl_inode, posix_lock_t *lock, pthread_mutex_lock (&pl_inode->mutex); { - /* Send unlock before the actual lock to - prevent lock upgrade / downgrade - problems + /* Send unlock before the actual blocking lock + to support lock upgrades / downgrades. */ - - ret = pl_send_prelock_unlock (this, pl_inode, - lock); - if (ret) - gf_log (this->name, GF_LOG_DEBUG, - "Could not send pre-lock " - "unlock"); + if (can_block) { + ret = pl_send_prelock_unlock (this, pl_inode, + lock); + if (ret) + gf_log (this->name, GF_LOG_DEBUG, + "Could not send pre-lock " + "unlock"); + } if (__is_lock_grantable (pl_inode, lock)) { gf_log (this->name, GF_LOG_TRACE, -- cgit