From e125e2ae61c31da798ea9a7342ea9292f47c1d6b Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Tue, 19 Feb 2013 12:11:57 +0530 Subject: glusterd: Mark vol as deleted by renaming voldir before cleaning up the store PROBLEM: During 'volume delete', when glusterd fails to erase all information about a volume from the backend store (for instance because rmdir() failed on non-empty directories), not only does volume delete fail on that node, but also subsequent attempts to restart glusterd fail because the volume store is left in an inconsistent state. FIX: Rename the volume directory path to a new location /trash/.deleted, and then go on to clean up its contents. The volume is considered deleted once rename() succeeds, irrespective of whether the cleanup succeeds or not. Change-Id: Iaf18e1684f0b101808bd5e1cd53a5d55790541a8 BUG: 889630 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/4639 Reviewed-by: Amar Tumballi Reviewed-by: Kaushal M Reviewed-by: Jeff Darcy Tested-by: Gluster Build System --- xlators/mgmt/glusterd/src/glusterd-utils.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index d07b8b1a51e..09e3ff66940 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -5495,11 +5495,15 @@ glusterd_delete_brick (glusterd_volinfo_t* volinfo, glusterd_brickinfo_t *brickinfo) { int ret = 0; + char voldir[PATH_MAX] = {0,}; + glusterd_conf_t *priv = THIS->private; GF_ASSERT (volinfo); GF_ASSERT (brickinfo); + GLUSTERD_GET_VOLUME_DIR(voldir, volinfo, priv); + glusterd_delete_volfile (volinfo, brickinfo); - glusterd_store_delete_brick (volinfo, brickinfo); + glusterd_store_delete_brick (brickinfo, voldir); glusterd_brickinfo_delete (brickinfo); volinfo->brick_count--; return ret; -- cgit