From baf66413aa1d7ea65d092f2301d2ec749b6a217e Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Wed, 6 Jul 2011 14:10:25 +0530 Subject: glusterd: handle replace-brick in paused state. This change ensures that glusterd retains 'state' information of an ongoing replace brick operation even if it went down midway. Change-Id: I697c2f27a96b3200c7865bd1d3a1de9692ce0da1 BUG: 3252 Reviewed-on: http://review.gluster.com/6 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 230c29c47d3..780738df23d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -4056,11 +4056,6 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict) "Failed to generate nfs volume file"); } - ret = glusterd_store_volinfo (volinfo, - GLUSTERD_VOLINFO_VER_AC_INCREMENT); - - if (ret) - goto out; ret = glusterd_fetchspec_notify (THIS); glusterd_set_rb_status (volinfo, GF_RB_STATUS_NONE); @@ -4129,6 +4124,16 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict) "received status - doing nothing"); ctx = glusterd_op_get_ctx (GD_OP_REPLACE_BRICK); if (ctx) { + if (glusterd_is_rb_paused (volinfo)) { + ret = dict_set_str (ctx, "status-reply", + "replace brick has been paused"); + if (ret) + gf_log (THIS->name, GF_LOG_ERROR, + "failed to set pump status" + "in ctx"); + goto out; + } + ret = rb_do_operation_status (volinfo, src_brickinfo, dst_brickinfo); if (ret) @@ -4142,9 +4147,12 @@ glusterd_op_replace_brick (dict_t *dict, dict_t *rsp_dict) ret = -1; goto out; } - + if (!ret && replace_op != GF_REPLACE_OP_STATUS) + ret = glusterd_store_volinfo (volinfo, + GLUSTERD_VOLINFO_VER_AC_INCREMENT); if (ret) - goto out; + gf_log (THIS->name, GF_LOG_ERROR, "Couldn't store" + " replace brick operation's state"); out: return ret; -- cgit