diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2017-03-20 12:32:33 -0400 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2017-03-30 23:33:32 -0400 |
commit | a7ce0548b7969050644891cd90c0bf134fa1594c (patch) | |
tree | 484e634b55b55830e1003c797c8e9e4c47418313 /xlators/mgmt/glusterd/src/glusterd-op-sm.c | |
parent | ed89f3ef064b6100bb0731f2493d915f6fb141c3 (diff) |
glusterd: hold off volume deletes while still restarting bricks
We need to do this because modifying the volume/brick tree while
glusterd_restart_bricks is still walking it can lead to segfaults.
Without waiting we could accidentally "slip in" while attach_brick has
released big_lock between retries and make such a modification.
Change-Id: I30ccc4efa8d286aae847250f5d4fb28956a74b03
BUG: 1432542
Signed-off-by: Jeff Darcy <jeff@pl.atyp.us>
Reviewed-on: https://review.gluster.org/16927
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>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 55c2bda1dd1..3558ae91059 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -6044,6 +6044,15 @@ glusterd_op_stage_validate (glusterd_op_t op, dict_t *dict, char **op_errstr, return ret; } +static void +glusterd_wait_for_blockers (glusterd_conf_t *priv) +{ + while (priv->blockers) { + synclock_unlock (&priv->big_lock); + sleep (1); + synclock_lock (&priv->big_lock); + } +} int32_t glusterd_op_commit_perform (glusterd_op_t op, dict_t *dict, char **op_errstr, @@ -6063,18 +6072,22 @@ glusterd_op_commit_perform (glusterd_op_t op, dict_t *dict, char **op_errstr, break; case GD_OP_STOP_VOLUME: + glusterd_wait_for_blockers (this->private); ret = glusterd_op_stop_volume (dict); break; case GD_OP_DELETE_VOLUME: + glusterd_wait_for_blockers (this->private); ret = glusterd_op_delete_volume (dict); break; case GD_OP_ADD_BRICK: + glusterd_wait_for_blockers (this->private); ret = glusterd_op_add_brick (dict, op_errstr); break; case GD_OP_REPLACE_BRICK: + glusterd_wait_for_blockers (this->private); ret = glusterd_op_replace_brick (dict, rsp_dict); break; @@ -6082,11 +6095,13 @@ glusterd_op_commit_perform (glusterd_op_t op, dict_t *dict, char **op_errstr, ret = glusterd_op_set_volume (dict, op_errstr); break; + case GD_OP_RESET_VOLUME: ret = glusterd_op_reset_volume (dict, op_errstr); break; case GD_OP_REMOVE_BRICK: + glusterd_wait_for_blockers (this->private); ret = glusterd_op_remove_brick (dict, op_errstr); break; |