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