From 3d653908554dc92af6b7414df4083bee2b9e039f Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Wed, 18 Apr 2012 14:30:16 +0530 Subject: glusterd: Disconnected bricks of 'stale' volume before deleting it. If glusterd_delete_bricks is called before glusterd got the DISCONNECT event from the brick that was stopped, then glusterd_brick_rpc_notify would dereference a free'd brickinfo. This can happen if the brick had not been disconnected before. Change-Id: I6c07ec50f6739422a14478a549edd06c4c0ce913 BUG: 802015 Signed-off-by: Krishnan Parthasarathi Reviewed-on: http://review.gluster.com/3442 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-utils.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'xlators/mgmt/glusterd') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index f04792c7b9a..ab72d85149a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -2420,7 +2420,8 @@ glusterd_delete_stale_volume (glusterd_volinfo_t *stale_volinfo, * stop stale bricks. Stale volume information is going to be deleted. * Which deletes the valid brick information inside stale volinfo. * We dont want brick_rpc_notify to access already deleted brickinfo. - * Disconnect valid bricks. + * Disconnect all bricks from stale_volinfo (unconditionally), since + * they are being deleted subsequently. */ if (glusterd_is_volume_started (stale_volinfo)) { if (glusterd_is_volume_started (valid_volinfo)) { @@ -2429,10 +2430,12 @@ glusterd_delete_stale_volume (glusterd_volinfo_t *stale_volinfo, //Only valid bricks will be running now. (void) glusterd_volinfo_copy_brick_portinfo (valid_volinfo, stale_volinfo); - (void) glusterd_volume_disconnect_all_bricks (stale_volinfo); + } else { (void) glusterd_stop_bricks (stale_volinfo); } + + (void) glusterd_volume_disconnect_all_bricks (stale_volinfo); } /* Delete all the bricks and stores and vol files. They will be created * again by the valid_volinfo. Volume store delete should not be -- cgit