From a6614f7fa917b2f3e518338c560edb4115b99b30 Mon Sep 17 00:00:00 2001 From: Sakshi Bansal Date: Thu, 5 Nov 2015 15:09:31 +0530 Subject: glusterd: remove-brick commit should not succeed when migration failed While remove a brick if the data migration was not successful, remove-brick commit should not succeed as this can lead to data loss. Backport of http://review.gluster.org/#/c/12513/ > Change-Id: I1eac0ef775cc6910ece0e46ebb04051444d54393 > BUG: 1278325 > Signed-off-by: Sakshi Bansal > Reviewed-on: http://review.gluster.org/12513 > Smoke: Gluster Build System > NetBSD-regression: NetBSD Build System > CentOS-regression: Gluster Build System > Reviewed-by: Atin Mukherjee > Tested-by: Atin Mukherjee Change-Id: I1eac0ef775cc6910ece0e46ebb04051444d54393 BUG: 1332370 Signed-off-by: Sakshi Bansal Reviewed-on: http://review.gluster.org/14190 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Niels de Vos CentOS-regression: Gluster Build System --- xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index b6d9703591c..35c834a11ce 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -2140,6 +2140,12 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) goto out; } + if (volinfo->rebal.defrag_status == GF_DEFRAG_STATUS_FAILED) { + errstr = gf_strdup ("use 'force' option as migration " + "has failed"); + goto out; + } + ret = glusterd_remove_brick_validate_bricks (cmd, brick_count, dict, volinfo, &errstr); -- cgit