diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2012-05-19 11:14:25 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-05-22 04:30:35 -0700 |
commit | 86c8e411143a9ee2bfd81270676ebd2a987cf946 (patch) | |
tree | 3677e32024becbcf66846d8e04ff3a71e1fcd0d6 /xlators/protocol/server/src/server-helpers.c | |
parent | 27960b127ea55f1bd877c1e421c93fea3a2c42af (diff) |
protocol/server: del_locker should delete one locker per unlock
BUG: 771595
Change-Id: If1c352b2d65938ad07f2e4b70c0e58c2d3be11bc
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3399
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/protocol/server/src/server-helpers.c')
-rw-r--r-- | xlators/protocol/server/src/server-helpers.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index 7c5106d01..51086aaf9 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -188,13 +188,11 @@ gf_del_locker (server_connection_t *conn, const char *volume, struct _locker *tmp = NULL; int32_t ret = -1; struct list_head *head = NULL; - struct list_head del; struct _lock_table *table = NULL; + int found = 0; GF_VALIDATE_OR_GOTO ("server", volume, out); - INIT_LIST_HEAD (&del); - pthread_mutex_lock (&conn->lock); { table = conn->ltable; @@ -210,19 +208,21 @@ gf_del_locker (server_connection_t *conn, const char *volume, continue; if (locker->fd && fd && (locker->fd == fd)) - list_move_tail (&locker->lockers, &del); + found = 1; else if (locker->loc.inode && loc && (locker->loc.inode == loc->inode)) - list_move_tail (&locker->lockers, &del); + found = 1; + if (found) { + list_del_init (&locker->lockers); + break; + } } + if (!found) + locker = NULL; } pthread_mutex_unlock (&conn->lock); - tmp = NULL; - locker = NULL; - - list_for_each_entry_safe (locker, tmp, &del, lockers) { - list_del_init (&locker->lockers); + if (locker) { if (locker->fd) fd_unref (locker->fd); else |