From 23495efe35515891cc56b49ef967d5b1ba195e3e Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Mon, 19 Dec 2011 12:45:34 +0530 Subject: features/locks: Fix release of locks on disconnect When a disconnect comes on a transport, all the locks on that transport should be cleared irrespective of entry presence. Change-Id: I1c432ec1ddc8fe3f7bf236992f47437d0dacd6ae BUG: 765430 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.com/808 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Vijay Bellur --- xlators/features/locks/src/inodelk.c | 39 ++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 'xlators') diff --git a/xlators/features/locks/src/inodelk.c b/xlators/features/locks/src/inodelk.c index 94ecfc265ad..1db08e05858 100644 --- a/xlators/features/locks/src/inodelk.c +++ b/xlators/features/locks/src/inodelk.c @@ -381,6 +381,7 @@ release_inode_locks_of_transport (xlator_t *this, pl_dom_list_t *dom, struct list_head released; char *path = NULL; + char *file = NULL; INIT_LIST_HEAD (&granted); INIT_LIST_HEAD (&released); @@ -396,18 +397,16 @@ release_inode_locks_of_transport (xlator_t *this, pl_dom_list_t *dom, 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; - } + inode_path (inode, NULL, &path); + if (path) + file = path; + else + file = uuid_utoa (inode->gfid); - gf_log (this->name, GF_LOG_TRACE, - "releasing lock on %s held by " + gf_log (this->name, GF_LOG_DEBUG, + "releasing blocking lock on %s held by " "{transport=%p, pid=%"PRId64" lk-owner=%"PRIu64"}", - path, trans, - (uint64_t) l->client_pid, - l->owner); + file, trans, (uint64_t) l->client_pid, l->owner); list_add (&l->blocked_locks, &released); if (path) { @@ -423,26 +422,22 @@ release_inode_locks_of_transport (xlator_t *this, pl_dom_list_t *dom, __delete_inode_lock (l); __destroy_inode_lock (l); + inode_path (inode, NULL, &path); + if (path) + file = path; + else + file = uuid_utoa (inode->gfid); - 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 " + gf_log (this->name, GF_LOG_DEBUG, + "releasing granted lock on %s held by " "{transport=%p, pid=%"PRId64" lk-owner=%"PRIu64"}", - path, trans, - (uint64_t) l->client_pid, - l->owner); + file, trans, (uint64_t) l->client_pid, l->owner); if (path) { GF_FREE (path); path = NULL; } } } -unlock: if (path) GF_FREE (path); -- cgit