From 9fd44bd90ecb60760919bda85308132341f857f9 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Sun, 18 Mar 2012 13:07:30 +0530 Subject: protocol/server: Clear internal locks on disconnect If there is a disconnect observed on the client when the inode/entry unlock is issued, but the reconnection to server happens with in the grace-time period the inode/entry lk will live and the unlock will never come from that client. The internal locks should be cleared on disconnect. Change-Id: Ib45b1035cfe3b1de381ef3b331c930011e7403be BUG: 803209 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.com/2966 Reviewed-by: Anand Avati Tested-by: Gluster Build System --- xlators/protocol/server/src/server-helpers.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'xlators/protocol/server/src/server-helpers.c') diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index 40b1efc9b..adcf9c1f1 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -506,15 +506,17 @@ do_connection_cleanup (xlator_t *this, server_connection_t *conn, GF_VALIDATE_OR_GOTO ("server", this, out); GF_VALIDATE_OR_GOTO ("server", conn, out); - GF_VALIDATE_OR_GOTO ("server", fdentries, out); - GF_VALIDATE_OR_GOTO ("server", ltable, out); + + if (!ltable && !fdentries) + goto out; frame = create_frame (this, this->ctx->pool); if (frame == NULL) { goto out; } - saved_ret = do_lock_table_cleanup (this, conn, frame, ltable); + if (ltable) + saved_ret = do_lock_table_cleanup (this, conn, frame, ltable); if (fdentries != NULL) { ret = do_fd_cleanup (this, conn, frame, fdentries, fd_count); @@ -536,24 +538,26 @@ out: int -server_connection_cleanup (xlator_t *this, server_connection_t *conn) +server_connection_cleanup (xlator_t *this, server_connection_t *conn, + int32_t flags) { struct _lock_table *ltable = NULL; fdentry_t *fdentries = NULL; uint32_t fd_count = 0; int ret = 0; - GF_VALIDATE_OR_GOTO ("server", this, out); - GF_VALIDATE_OR_GOTO ("server", conn, out); + GF_VALIDATE_OR_GOTO (this->name, this, out); + GF_VALIDATE_OR_GOTO (this->name, conn, out); + GF_VALIDATE_OR_GOTO (this->name, flags, out); pthread_mutex_lock (&conn->lock); { - if (conn->ltable) { + if (conn->ltable && (flags & INTERNAL_LOCKS)) { ltable = conn->ltable; conn->ltable = gf_lock_table_new (); } - if (conn->fdtable) + if (conn->fdtable && (flags & POSIX_LOCKS)) fdentries = gf_fd_fdtable_get_all_fds (conn->fdtable, &fd_count); } -- cgit