summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2012-05-19 11:14:25 +0530
committerAnand Avati <avati@redhat.com>2012-05-19 01:22:27 -0700
commit43d9661f4ad1566981676d08f6ddf02109ca5757 (patch)
tree224506e79fc1b51220d33e9f2f43d4f09cd33801 /xlators/protocol/server/src
parent46d4372003434b149a1e7cea98903e82c914e4b3 (diff)
protocol/server: del_locker should delete one locker per unlock
Change-Id: Ie3281d693c1b6d1f631c77aece8039a08ad8f8fb BUG: 771595 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/3370 Reviewed-by: Amar Tumballi <amarts@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/protocol/server/src')
-rw-r--r--xlators/protocol/server/src/server-helpers.c20
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 01c21636b6b..8827a48b041 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