summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks/src
diff options
context:
space:
mode:
authorPavan Sondur <pavan@gluster.com>2009-12-02 08:34:25 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-12-02 10:29:37 -0800
commit494db717941e90ae209d416e00bf2c63490ba75e (patch)
tree5f535c4af9014e59debafd8f3c4b055ffd78b592 /xlators/features/locks/src
parent7d740b2c01224019525fda01235f56c3a4416747 (diff)
features/locks: Release blocked locks also when server requests to release all locks of a 'transport'.
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> 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
Diffstat (limited to 'xlators/features/locks/src')
-rw-r--r--xlators/features/locks/src/entrylk.c21
-rw-r--r--xlators/features/locks/src/inodelk.c37
2 files changed, 46 insertions, 12 deletions
diff --git a/xlators/features/locks/src/entrylk.c b/xlators/features/locks/src/entrylk.c
index e96097cc1f8..7f890429a5a 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) {
diff --git a/xlators/features/locks/src/inodelk.c b/xlators/features/locks/src/inodelk.c
index 89bb81f4224..b2a5cb2e4a5 100644
--- a/xlators/features/locks/src/inodelk.c
+++ b/xlators/features/locks/src/inodelk.c
@@ -307,10 +307,12 @@ __grant_blocked_inode_locks (xlator_t *this, pl_inode_t *pl_inode, pl_dom_list_t
pl_inode_lock_t *bl = NULL;
pl_inode_lock_t *tmp = NULL;
- list_for_each_entry_safe (bl, tmp, &dom->blocked_inodelks, blocked_locks) {
+ struct list_head blocked_list;
- if (__inodelk_grantable (dom, bl))
- continue;
+ INIT_LIST_HEAD (&blocked_list);
+ list_splice_init (&dom->blocked_inodelks, &blocked_list);
+
+ list_for_each_entry_safe (bl, tmp, &blocked_list, blocked_locks) {
list_del_init (&bl->blocked_locks);
@@ -368,8 +370,27 @@ release_inode_locks_of_transport (xlator_t *this, pl_dom_list_t *dom,
pthread_mutex_lock (&pinode->mutex);
{
- if (list_empty (&dom->inodelk_list)) {
- goto unlock;
+
+ list_for_each_entry_safe (l, tmp, &dom->blocked_inodelks, blocked_locks) {
+ if (l->transport != trans)
+ continue;
+
+ list_del_init (&l->blocked_locks);
+
+ if (inode_path (inode, NULL, &path) < 0) {
+ gf_log (this->name, GF_LOG_TRACE,
+ "inode_path failed");
+ goto unlock;
+ }
+
+ gf_log (this->name, GF_LOG_TRACE,
+ "releasing lock on %s held by "
+ "{transport=%p, pid=%"PRId64"}",
+ path, trans,
+ (uint64_t) l->client_pid);
+
+ FREE (l);
+
}
list_for_each_entry_safe (l, tmp, &dom->inodelk_list, list) {
@@ -380,8 +401,6 @@ release_inode_locks_of_transport (xlator_t *this, pl_dom_list_t *dom,
grant_blocked_inode_locks (this, pinode, l, dom);
- __destroy_inode_lock (l);
-
if (inode_path (inode, NULL, &path) < 0) {
gf_log (this->name, GF_LOG_TRACE,
"inode_path failed");
@@ -394,6 +413,10 @@ release_inode_locks_of_transport (xlator_t *this, pl_dom_list_t *dom,
path, trans,
(uint64_t) l->client_pid);
+
+ __destroy_inode_lock (l);
+
+
}
}
unlock: