diff options
author | Pavan Sondur <pavan@gluster.com> | 2010-11-18 05:38:59 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-11-18 05:56:10 -0800 |
commit | e098653b73c7b379b2ad6bf7878bac65147f7ebe (patch) | |
tree | fd3390e821e6ba8d1e5cb1736ef08e8b5c468676 /xlators/features | |
parent | e111591585c8e5f3c8404b72ad13b5f5580c25c4 (diff) |
features/locks: Send prelock unlock only if it is not grantable and is a blocking lock call.
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1017 (Locking deadlock when upgrading lock)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1017
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/locks/src/common.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c index e295e4fd518..ade440a7d0d 100644 --- a/xlators/features/locks/src/common.c +++ b/xlators/features/locks/src/common.c @@ -985,15 +985,20 @@ pl_setlk (xlator_t *this, pl_inode_t *pl_inode, posix_lock_t *lock, { /* Send unlock before the actual lock to prevent lock upgrade / downgrade - problems + problems only if: + - it is a blocking call + - it has other conflicting locks */ - ret = pl_send_prelock_unlock (this, pl_inode, - lock); - if (ret) - gf_log (this->name, GF_LOG_DEBUG, + if (can_block && + !(__is_lock_grantable (pl_inode, lock))) { + ret = pl_send_prelock_unlock (this, pl_inode, + lock); + if (ret) + gf_log (this->name, GF_LOG_DEBUG, "Could not send pre-lock " - "unlock"); + "unlock"); + } if (__is_lock_grantable (pl_inode, lock)) { gf_log (this->name, GF_LOG_TRACE, |