From 494db717941e90ae209d416e00bf2c63490ba75e Mon Sep 17 00:00:00 2001 From: Pavan Sondur Date: Wed, 2 Dec 2009 08:34:25 +0000 Subject: features/locks: Release blocked locks also when server requests to release all locks of a 'transport'. Signed-off-by: Pavan Vilas Sondur Signed-off-by: Anand V. Avati BUG: 222 (Enhance Internal locks to support multilple domains and rewrite inodelks) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=222 --- xlators/features/locks/src/entrylk.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'xlators/features/locks/src/entrylk.c') diff --git a/xlators/features/locks/src/entrylk.c b/xlators/features/locks/src/entrylk.c index e96097cc1..7f890429a 100644 --- a/xlators/features/locks/src/entrylk.c +++ b/xlators/features/locks/src/entrylk.c @@ -513,9 +513,20 @@ release_entry_locks_for_transport (xlator_t *this, pl_inode_t *pinode, pthread_mutex_lock (&pinode->mutex); { - if (list_empty (&dom->entrylk_list)) { - goto unlock; - } + list_for_each_entry_safe (lock, tmp, &dom->blocked_entrylks, + blocked_locks) { + if (lock->trans != trans) + continue; + + list_del_init (&lock->blocked_locks); + + gf_log (this->name, GF_LOG_TRACE, + "releasing lock on held by " + "{transport=%p}",trans); + + FREE (lock->basename); + FREE (lock); + } list_for_each_entry_safe (lock, tmp, &dom->entrylk_list, domain_list) { @@ -526,7 +537,7 @@ release_entry_locks_for_transport (xlator_t *this, pl_inode_t *pinode, gf_log (this->name, GF_LOG_TRACE, "releasing lock on held by " - "{transport=%p}",trans);; + "{transport=%p}",trans); FREE (lock->basename); FREE (lock); @@ -535,7 +546,7 @@ release_entry_locks_for_transport (xlator_t *this, pl_inode_t *pinode, __grant_blocked_entry_locks (this, pinode, dom, &granted); } -unlock: + pthread_mutex_unlock (&pinode->mutex); list_for_each_entry_safe (lock, tmp, &granted, blocked_locks) { -- cgit