diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2017-02-02 13:08:04 -0500 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-02-03 08:46:53 -0500 |
commit | ef25dbe39fd5e89a208b9c1698aaab74c014d7d5 (patch) | |
tree | 2226f20018201aec096dee53c838a27adcfba2e5 /xlators | |
parent | 0692e1c8f40333cc85637a85663b353f20f663b9 (diff) |
glusterd: double-check brick liveness for remove-brick validation
Same problem as https://review.gluster.org/#/c/16509/ in a different
place. Tests detach bricks without glusterd's knowledge, so
glusterd's internal brick state is out of date and we have to re-check
(via the brick's pidfile) as well.
Backport of:
> BUG: 1385758
> Change-Id: I169538c1c62d72a685a49d57ef65fb6c3db6eab2
> Reviewed-on: https://review.gluster.org/16529
BUG: 1418091
Change-Id: Id0b597bc60807ed090f6ecdba549c5cf3d758f98
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: https://review.gluster.org/16537
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index c78fbd8345c..7b5264ad8a1 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -1947,6 +1947,8 @@ glusterd_remove_brick_validate_bricks (gf1_op_commands cmd, int32_t brick_count, glusterd_peerinfo_t *peerinfo = NULL; int i = 0; int ret = -1; + char pidfile[PATH_MAX+1] = {0,}; + glusterd_conf_t *priv = THIS->private; /* Check whether all the nodes of the bricks to be removed are * up, if not fail the operation */ @@ -2008,16 +2010,30 @@ 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) || - (cmd == GF_OP_CMD_DETACH_START) || - (cmd == GF_DEFRAG_CMD_DETACH_START)) && - brickinfo->status != GF_BRICK_STARTED) { + switch (cmd) { + case GF_OP_CMD_START: + case GF_OP_CMD_DETACH_START: + case GF_DEFRAG_CMD_DETACH_START: + break; + default: + continue; + } + if (brickinfo->status != GF_BRICK_STARTED) { snprintf (msg, sizeof (msg), "Found stopped " "brick %s", brick); *errstr = gf_strdup (msg); ret = -1; goto out; } + GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, + brickinfo, priv); + if (!gf_is_service_running (pidfile, NULL)) { + snprintf (msg, sizeof (msg), "Found dead " + "brick %s", brick); + *errstr = gf_strdup (msg); + ret = -1; + goto out; + } continue; } |