From 4e0d4b15717da1f6466133158a26927fb91384b8 Mon Sep 17 00:00:00 2001 From: Jeff Darcy Date: Fri, 17 Feb 2017 09:42:46 -0500 Subject: glusterd: take conn->lock around operations on conn->reconnect Failure to do this could lead to a race in which a timer would be removed twice concurrently, corrupting the timer list (because gf_timer_call_cancel has no internal protection against this) and possibly causing a crash. Change-Id: Ic1a8b612d436daec88fd6cee935db0ae81a47d5c BUG: 1421721 Signed-off-by: Jeff Darcy Reviewed-on: https://review.gluster.org/16662 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Atin Mukherjee --- xlators/mgmt/glusterd/src/glusterd-utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index c7ec02afe47..0d2518ac384 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -1875,10 +1875,11 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo, if (rpc) { brickinfo->rpc = NULL; conn = &rpc->conn; + pthread_mutex_lock (&conn->lock); if (conn->reconnect) { (void ) gf_timer_call_cancel (rpc->ctx, conn->reconnect); - //rpc_clnt_unref (rpc); } + pthread_mutex_unlock (&conn->lock); rpc_clnt_unref (rpc); } -- cgit