From d90b46a23a523720f4e40de993ca61ff0ba43617 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Mon, 29 Jul 2013 19:05:50 +0530 Subject: glusterd : Checking session created or not in case of geo-rep stop Performing statefile check in case of geo-rep stop, so as to provide proper error message in case session is not created. However in case of geo-rep stop force, we allow the command to succeed even in case that the session is not created, because the stop command is a failsafe command to stop running geo-rep sessions on any nodes. Change-Id: I2b6a0253de977633606c422cbbc9e37cede9a268 BUG: 989541 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/5417 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c index d785cb05b..386d7a952 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c @@ -1947,7 +1947,13 @@ glusterd_op_stage_gsync_set (dict_t *dict, char **op_errstr) goto out; } + is_force = dict_get_str_boolean (dict, "force", _gf_false); + + /* Allowing stop force to bypass the statefile check + * as this command acts as a fail safe method to stop geo-rep + * session. */ if ((type == GF_GSYNC_OPTION_TYPE_CONFIG) || + ((type == GF_GSYNC_OPTION_TYPE_STOP) && !is_force) || (type == GF_GSYNC_OPTION_TYPE_DELETE)) { ret = lstat (statefile, &stbuf); if (ret) { @@ -1962,8 +1968,6 @@ glusterd_op_stage_gsync_set (dict_t *dict, char **op_errstr) } } - is_force = dict_get_str_boolean (dict, "force", _gf_false); - /* Check if all peers that are a part of the volume are up or not */ if ((type == GF_GSYNC_OPTION_TYPE_DELETE) || ((type == GF_GSYNC_OPTION_TYPE_STOP) && !is_force)) { -- cgit