From fb406f942befbe48eec75043d89ecd0824f91dd6 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Fri, 16 Mar 2012 16:25:07 +0530 Subject: protocol/server: add and remove the transports from the list, inside the lock Till now for graph changes, glusterfs client used to remember the old graph also. Hence the transport object on the server corresponding the old graph never received disconnect. But now since the graph cleanup is happening, transport on the server side gets disconnect for the cleaned up graph. Server maintains, all the transports in a list. But addition of the new transport to the list, or removal of the transport from the list is not happening within the lock. Thus if a thread is accessing a transport (in cases of statedump, where each transprt's information is dumped), and the server gets a disconnect on that transport, then it leads to segfault of the process. To avoid it do the list (of transports) manipulation inside the lock. Change-Id: I50e8389d5ec8f1c52b8d401ef8c8ddd262e82548 BUG: 803815 Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.com/2958 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- rpc/rpc-lib/src/rpc-transport.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rpc/rpc-lib/src/rpc-transport.c') diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c index 8a3b839c..78d1bff5 100644 --- a/rpc/rpc-lib/src/rpc-transport.c +++ b/rpc/rpc-lib/src/rpc-transport.c @@ -326,7 +326,7 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name) goto fail; } - return_trans = trans; + return_trans = trans; if (name) { GF_FREE (name); @@ -470,7 +470,7 @@ rpc_transport_unref (rpc_transport_t *this) pthread_mutex_lock (&this->lock); { - refcount = --this->refcount; + refcount = --this->refcount; } pthread_mutex_unlock (&this->lock); @@ -478,7 +478,7 @@ rpc_transport_unref (rpc_transport_t *this) if (this->mydata) this->notify (this, this->mydata, RPC_TRANSPORT_CLEANUP, NULL); - rpc_transport_destroy (this); + rpc_transport_destroy (this); } ret = 0; -- cgit