summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhari <hgowtham@redhat.com>2016-02-19 13:43:48 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-03-03 03:51:14 -0800
commit133441436875416258bdc1272db91fab73a7065c (patch)
tree1189afaf9e529893b16fae4f031f3d66a4e1ce0d
parentc57805324e8615dee4cbd6a8cc604f517845ac85 (diff)
Tier: making detach start fail when brick on hot tier is down
Currently detach tier start happens even when a hot brick is down this might lead to data loss. This patch prevents the detach tier start from being executed successfully if a brick in hot tier is down Change-Id: I3b6047a44bd01b8a6887d41f799f64de6bf075ef BUG: 1309999 Signed-off-by: hari <hgowtham@redhat.com> Reviewed-on: http://review.gluster.org/13474 Smoke: Gluster Build System <jenkins@build.gluster.com> Tested-by: hari gowtham <hari.gowtham005@gmail.com> Reviewed-by: Gaurav Kumar Garg <ggarg@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
-rw-r--r--tests/basic/tier/tierd_check.t6
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/tests/basic/tier/tierd_check.t b/tests/basic/tier/tierd_check.t
index 6edd2f3b795..9ef12d50211 100644
--- a/tests/basic/tier/tierd_check.t
+++ b/tests/basic/tier/tierd_check.t
@@ -53,4 +53,10 @@ TEST $CLI volume tier $V0 start force
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" tier_daemon_check
+# To test fordetach start fail while the brick is down
+
+TEST pkill -f "$B0/hot/$V0"
+
+TEST ! $CLI volume tier $V0 detach start
+
cleanup
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index 3c2218079f9..d77626d3457 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -1801,7 +1801,8 @@ glusterd_remove_brick_validate_bricks (gf1_op_commands cmd, int32_t brick_count,
}
if (glusterd_is_local_brick (THIS, volinfo, brickinfo)) {
- if (cmd == GF_OP_CMD_START &&
+ if (((cmd == GF_OP_CMD_START) ||
+ (cmd == GF_OP_CMD_DETACH_START)) &&
brickinfo->status != GF_BRICK_STARTED) {
snprintf (msg, sizeof (msg), "Found stopped "
"brick %s", brick);