summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2018-08-31 20:42:21 +0530
committerAtin Mukherjee <amukherj@redhat.com>2018-09-04 04:01:51 +0000
commit13deb311b2a48170489bb4f7cfd7def982281fd4 (patch)
tree784b41127ccc6c9e4140712cbb706da536819382
parentf29689783d970cba804505d7c778c905b2ba1992 (diff)
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 () Change-Id: I886202969c96eec3620f74cd7027652d6287f4be Fixes: bz#1624440 Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index e6efe11cf5c..51c81db2f35 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -2557,19 +2557,33 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,
* an actual signal instead.
*/
if (is_brick_mx_enabled () && last_brick != 1) {
- gf_msg_debug (this->name, 0, "About to send detach "
- "request for brick %s:%s",
- brickinfo->hostname, brickinfo->path);
+ 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);
- (void) send_attach_req (this, brickinfo->rpc,
- brickinfo->path, NULL, NULL,
- GLUSTERD_BRICK_TERMINATE);
} 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);
}