From 6aab9d9602dc1ef62a2d1d63aa1764a062bf9d9f Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Sat, 3 Mar 2012 17:28:17 +0530 Subject: protocol/server: Avoid race in add/del locker, connection_cleanup conn->ltable address keeps changing in server_connection_cleanup every time it is called. i.e. New ltable is created every time it is called. Here is the race that happened: --------------------------------------------------- thread-1 | thread-2 add_locker is called with | conn->ltable. lets call the | ltable address lt1 | | connection cleanup is called | and do_lock_table_cleanup is | triggered for lt1. locker | lists are splice_inited under | the lt1->lock lt1 adds the locker under | lt1->lock (lets call this l1) | | GF_FREE(lt1) happens in | do_lock_table_cleanup The locker l1 that is added just before lt1 is freed will never be cleared in the subsequent server_connection_cleanups as there does not exist a reference to the locker. The stale lock remains in the locks xlator even though the transport on which it was issued is destroyed. Change-Id: I0a02f16c703d1e7598b083aa1057cda9624eb3fe BUG: 787601 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.com/2957 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Amar Tumballi Reviewed-by: Anand Avati --- xlators/protocol/server/src/server-helpers.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xlators/protocol/server/src/server-helpers.h') diff --git a/xlators/protocol/server/src/server-helpers.h b/xlators/protocol/server/src/server-helpers.h index 9a502b47876..5ce5e36acfe 100644 --- a/xlators/protocol/server/src/server-helpers.h +++ b/xlators/protocol/server/src/server-helpers.h @@ -48,7 +48,7 @@ void free_state (server_state_t *state); void server_loc_wipe (loc_t *loc); int32_t -gf_add_locker (struct _lock_table *table, const char *volume, +gf_add_locker (server_connection_t *conn, const char *volume, loc_t *loc, fd_t *fd, pid_t pid, @@ -56,7 +56,7 @@ gf_add_locker (struct _lock_table *table, const char *volume, glusterfs_fop_t type); int32_t -gf_del_locker (struct _lock_table *table, const char *volume, +gf_del_locker (server_connection_t *conn, const char *volume, loc_t *loc, fd_t *fd, gf_lkowner_t *owner, -- cgit