21ab4e
From e14b34ff35f1d2f7fd2b091c7fea18b5157aaafd Mon Sep 17 00:00:00 2001
21ab4e
From: Atin Mukherjee <amukherj@redhat.com>
21ab4e
Date: Mon, 30 Oct 2017 15:55:32 +0530
21ab4e
Subject: [PATCH 630/631] glusterd: delete source brick only once in
21ab4e
 reset-brick commit force
21ab4e
21ab4e
While stopping the brick which is to be reset and replaced delete_brick
21ab4e
flag was passed as true which resulted glusterd to free up to source
21ab4e
brick before the actual operation. This results commit force to fail
21ab4e
failing to find the source brickinfo.
21ab4e
21ab4e
>upstream patch : https://review.gluster.org/#/c/18581
21ab4e
21ab4e
Change-Id: I1aa7508eff7cc9c9b5d6f5163f3bb92736d6df44
21ab4e
BUG: 1507172
21ab4e
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/121876
21ab4e
Tested-by: RHGS Build Bot <nigelb@redhat.com>
21ab4e
---
21ab4e
 .../bug-1507466-reset-brick-commit-force.t         | 24 ++++++++++++++++++++++
21ab4e
 xlators/mgmt/glusterd/src/glusterd-reset-brick.c   |  2 +-
21ab4e
 2 files changed, 25 insertions(+), 1 deletion(-)
21ab4e
 create mode 100644 tests/bugs/glusterd/bug-1507466-reset-brick-commit-force.t
21ab4e
21ab4e
diff --git a/tests/bugs/glusterd/bug-1507466-reset-brick-commit-force.t b/tests/bugs/glusterd/bug-1507466-reset-brick-commit-force.t
21ab4e
new file mode 100644
21ab4e
index 000000000..764399dfa
21ab4e
--- /dev/null
21ab4e
+++ b/tests/bugs/glusterd/bug-1507466-reset-brick-commit-force.t
21ab4e
@@ -0,0 +1,24 @@
21ab4e
+#!/bin/bash
21ab4e
+. $(dirname $0)/../../include.rc
21ab4e
+. $(dirname $0)/../../cluster.rc
21ab4e
+cleanup;
21ab4e
+
21ab4e
+function check_peers {
21ab4e
+        $CLI_1 peer status | grep 'Peer in Cluster (Connected)' | wc -l
21ab4e
+}
21ab4e
+
21ab4e
+TEST launch_cluster 3
21ab4e
+TEST $CLI_1 peer probe $H2;
21ab4e
+EXPECT_WITHIN $PROBE_TIMEOUT 1 check_peers
21ab4e
+
21ab4e
+TEST $CLI_1 volume create $V0 replica 2 $H1:$B0/${V0} $H2:$B0/${V0}
21ab4e
+TEST $CLI_1 volume start $V0
21ab4e
+
21ab4e
+# Negative case with brick not killed && volume-id xattrs present
21ab4e
+TEST ! $CLI_1 volume reset-brick $V0 $H1:$B0/${V0} $H1:$B0/${V0} commit force
21ab4e
+
21ab4e
+TEST $CLI_1 volume reset-brick $V0 $H1:$B0/${V0} start
21ab4e
+# Now test if reset-brick commit force works
21ab4e
+TEST $CLI_1 volume reset-brick $V0 $H1:$B0/${V0} $H1:$B0/${V0} commit force
21ab4e
+
21ab4e
+cleanup;
21ab4e
diff --git a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
21ab4e
index a187d1d18..985f58618 100644
21ab4e
--- a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
21ab4e
+++ b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
21ab4e
@@ -347,7 +347,7 @@ glusterd_op_reset_brick (dict_t *dict, dict_t *rsp_dict)
21ab4e
                         gf_msg_debug (this->name, 0, "I AM THE DESTINATION HOST");
21ab4e
                         ret = glusterd_volume_stop_glusterfs (volinfo,
21ab4e
                                                               src_brickinfo,
21ab4e
-                                                              _gf_true);
21ab4e
+                                                              _gf_false);
21ab4e
                         if (ret) {
21ab4e
                                 gf_msg (this->name, GF_LOG_CRITICAL, 0,
21ab4e
                                         GD_MSG_BRICK_STOP_FAIL,
21ab4e
-- 
21ab4e
2.13.6
21ab4e