From 42b956971c47fd0708cbbd17ce8c78c2ed79bfba Mon Sep 17 00:00:00 2001 From: Vijaikumar M Date: Fri, 23 May 2014 14:42:08 +0530 Subject: glusterd: Handle rpc_connect failure in the event handler Currently rpc_connect calls the notification function on failure in the same thread, glusterd notification holds the big_lock and hence big_lock is released before rpc_connect In snapshot creation, releasing the big-lock before completeing operation can cause problem like deadlock or memory corruption. Bricks are started as part of snapshot created operation. brick_start releases the big_lock when doing brick_connect and this might cause glusterd crash. There is a similar issue in bug# 1088355. Solution is let the event handler handle the failure than doing it in the rpc_connect. Change-Id: I088d44092ce845a07516c1d67abd02b220e08b38 BUG: 1101507 Signed-off-by: Vijaikumar M Reviewed-on: http://review.gluster.org/7843 Reviewed-by: Krishnan Parthasarathi Reviewed-by: Jeff Darcy Tested-by: Gluster Build System Reviewed-by: Raghavendra G Tested-by: Raghavendra G --- xlators/mgmt/glusterd/src/glusterd-handler.c | 2 -- xlators/mgmt/glusterd/src/glusterd-rebalance.c | 2 -- xlators/mgmt/glusterd/src/glusterd-snapshot.c | 4 ---- xlators/mgmt/glusterd/src/glusterd-utils.c | 4 ---- 4 files changed, 12 deletions(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 733bea236ed..e6b744af536 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -3135,9 +3135,7 @@ glusterd_friend_add (const char *hoststr, int port, if (!restore) { ret = glusterd_store_peerinfo (*friend); if (ret == 0) { - synclock_unlock (&conf->big_lock); ret = glusterd_friend_rpc_create (this, *friend, args); - synclock_lock (&conf->big_lock); } else { gf_log (this->name, GF_LOG_ERROR, diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index cf2272028c6..f2e7338a80e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -374,10 +374,8 @@ glusterd_rebalance_rpc_create (glusterd_volinfo_t *volinfo, } glusterd_volinfo_ref (volinfo); - synclock_unlock (&priv->big_lock); ret = glusterd_rpc_create (&defrag->rpc, options, glusterd_defrag_notify, volinfo); - synclock_lock (&priv->big_lock); if (ret) { gf_msg (THIS->name, GF_LOG_ERROR, 0, GD_MSG_RPC_CREATE_FAIL, "Glusterd RPC creation failed"); diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c index eef6129745a..7d3c795b436 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c @@ -4812,10 +4812,6 @@ glusterd_snapshot_create_commit (dict_t *dict, char **op_errstr, goto out; } - /*TODO: As of now start the bricks as part of snapshot creation op. - brick_start releases the big_lock and this can cause regression - for bug# 1088355. - We need to fix brick_connect not to release big_lock*/ list_for_each_entry (snap_vol, &snap->volumes, vol_list) { list_for_each_entry (brickinfo, &snap_vol->bricks, brick_list) { ret = glusterd_brick_start (snap_vol, brickinfo, diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 540e97b8633..a2a746d247e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -1717,11 +1717,9 @@ glusterd_brick_connect (glusterd_volinfo_t *volinfo, if (ret < 0) goto out; - synclock_unlock (&priv->big_lock); ret = glusterd_rpc_create (&rpc, options, glusterd_brick_rpc_notify, brickid); - synclock_lock (&priv->big_lock); if (ret) { GF_FREE (brickid); goto out; @@ -5735,11 +5733,9 @@ glusterd_nodesvc_connect (char *server, char *socketpath) 600); if (ret) goto out; - synclock_unlock (&priv->big_lock); ret = glusterd_rpc_create (&rpc, options, glusterd_nodesvc_rpc_notify, server); - synclock_lock (&priv->big_lock); if (ret) goto out; (void) glusterd_nodesvc_set_rpc (server, rpc); -- cgit