summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src/server-helpers.c
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2011-12-19 18:35:19 +0530
committerVijay Bellur <vijay@gluster.com>2011-12-22 05:13:08 -0800
commitbddb3a014af22133d958da96ad32a02f8ff66805 (patch)
tree11be405709768641d7cc4f18a3d0938fb7801bea /xlators/protocol/server/src/server-helpers.c
parent23495efe35515891cc56b49ef967d5b1ba195e3e (diff)
protocol/server: Do connection cleanup if reply fails
We observed that after the first connection cleanup happens on DISCONNECT the lock calls in transit are granted or added in blocked locks queue. These locks were never cleaned up after that because no unlock would come up on that connection. This would leave references on that transport so it would never be destroyed. Now, the connection cleanup happens whenever the reply submission fails. Also cleaned up the old code which is not used any more. Change-Id: Ie4fe6f388ed18d9c907cf8ae06b0b7fd0601a660 BUG: 765430 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/809 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.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.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index 600d73cce81..45f14dcb36e 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -552,7 +552,6 @@ out:
int
server_connection_cleanup (xlator_t *this, server_connection_t *conn)
{
- char do_cleanup = 0;
struct _lock_table *ltable = NULL;
fdentry_t *fdentries = NULL;
uint32_t fd_count = 0;
@@ -563,24 +562,20 @@ server_connection_cleanup (xlator_t *this, server_connection_t *conn)
pthread_mutex_lock (&conn->lock);
{
- conn->active_transports--;
- if (conn->active_transports == 0) {
- if (conn->ltable) {
- ltable = conn->ltable;
- conn->ltable = gf_lock_table_new ();
- }
-
- if (conn->fdtable) {
- fdentries = gf_fd_fdtable_get_all_fds (conn->fdtable,
- &fd_count);
- }
- do_cleanup = 1;
+ if (conn->ltable) {
+ ltable = conn->ltable;
+ conn->ltable = gf_lock_table_new ();
}
+
+ if (conn->fdtable)
+ fdentries = gf_fd_fdtable_get_all_fds (conn->fdtable,
+ &fd_count);
}
pthread_mutex_unlock (&conn->lock);
- if (do_cleanup && conn->bound_xl)
- ret = do_connection_cleanup (this, conn, ltable, fdentries, fd_count);
+ if (conn->bound_xl)
+ ret = do_connection_cleanup (this, conn, ltable,
+ fdentries, fd_count);
out:
return ret;
@@ -814,7 +809,6 @@ server_connection_get (xlator_t *this, const char *id)
list_add (&conn->list, &conf->conns);
conn->ref++;
- conn->active_transports++;
}
unlock:
pthread_mutex_unlock (&conf->mutex);