glusterfs/0366-glusterd-fail-volume-stop-operation-if-brick-detach-.patch
Sunil Kumar Acharya be071b020b autobuild v3.12.2-19
Resolves: bz#1459709 bz#1610743 bz#1618221 bz#1619627 bz#1622649
Resolves: bz#1623749 bz#1623874 bz#1624444 bz#1625622 bz#1626780
Resolves: bz#1627098 bz#1627617 bz#1627639 bz#1630688
Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
2018-09-21 23:36:36 -04:00

80 lines
3.9 KiB
Diff

From d67fddc4e6439f6aadd76da1a2058ffb7a4940d4 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Fri, 31 Aug 2018 20:42:21 +0530
Subject: [PATCH 366/385] glusterd: fail volume stop operation if brick detach
fails
While sending a detach request for a brick in brick multiplexing mode,
in any situation if the brick isn't connected, glusterd will fail to
detach the brick but due to the missing error code handling, glusterd
will mark the volume as stopped.
Fix is to handle the return code of send_attach_req in
glusterd_volume_stop_glusterfs ()
>upstream patch : https://review.gluster.org/#/c/glusterfs/+/21055/
>Change-Id: I886202969c96eec3620f74cd7027652d6287f4be
>Fixes: bz#1624440
>Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Change-Id: I886202969c96eec3620f74cd7027652d6287f4be
BUG: 1624444
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/149873
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-utils.c | 31 +++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 7f52602..3db3a15 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -2496,19 +2496,32 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,
* an actual signal instead.
*/
if (is_brick_mx_enabled ()) {
- gf_msg_debug (this->name, 0, "About to send detach "
- "request for brick %s:%s",
- brickinfo->hostname, brickinfo->path);
-
- (void) send_attach_req (this, brickinfo->rpc,
- brickinfo->path, NULL, NULL,
- GLUSTERD_BRICK_TERMINATE);
+ ret = send_attach_req (this, brickinfo->rpc,
+ brickinfo->path, NULL, NULL,
+ GLUSTERD_BRICK_TERMINATE);
+ if (ret && brickinfo->status == GF_BRICK_STARTED) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_STOP_FAIL, "Failed to send"
+ " detach request for brick %s",
+ brickinfo->path);
+ goto out;
+ }
+ gf_log (this->name, GF_LOG_INFO, "Detach request for "
+ "brick %s:%s is sent successfully",
+ brickinfo->hostname, brickinfo->path);
} else {
gf_msg_debug (this->name, 0, "About to stop glusterfsd"
" for brick %s:%s", brickinfo->hostname,
brickinfo->path);
- (void) glusterd_brick_terminate (volinfo, brickinfo,
- NULL, 0, &op_errstr);
+ ret = glusterd_brick_terminate (volinfo, brickinfo,
+ NULL, 0, &op_errstr);
+ if (ret && brickinfo->status == GF_BRICK_STARTED) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_STOP_FAIL, "Failed to kill"
+ " the brick %s", brickinfo->path);
+ goto out;
+ }
+
if (op_errstr) {
GF_FREE (op_errstr);
}
--
1.8.3.1