summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2016-01-30 08:47:35 +0530
committerAtin Mukherjee <amukherj@redhat.com>2016-02-23 07:04:28 -0800
commit28c2798d5e1f36e3f57192b693758fa8a9f26743 (patch)
treea2d1cedf75753419a5543946e571a7781a9fd66d /xlators/mgmt/glusterd
parent794e3e8a7448219e0de303e57b0104896b18746e (diff)
glusterd: set decommission_is_in_progress flag for inprogress remove-brick op on glusterd restart
Backport of http://review.gluster.org/13323 While remove brick is in progress, if glusterd is restarted since decommission flag is not persisted in the store the same value is not retained back resulting in glusterd not blocking remove brick commit when rebalance is already in progress. Change-Id: Ibbf12f3792d65ab1293fad1e368568be141a1cd6 BUG: 1310972 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: http://review.gluster.org/13323 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Gaurav Kumar Garg <ggarg@redhat.com> Reviewed-by: mohammed rafi kc <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/13489
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c16
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h4
2 files changed, 19 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 0639a910217..5db5d0a58eb 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -7213,6 +7213,7 @@ glusterd_restart_rebalance_for_volume (glusterd_volinfo_t *volinfo)
if (!volinfo->rebal.defrag_cmd)
return -1;
+
if (!gd_should_i_start_rebalance (volinfo)) {
/* Store the rebalance-id and rebalance command even if
@@ -7229,7 +7230,20 @@ glusterd_restart_rebalance_for_volume (glusterd_volinfo_t *volinfo)
return 0;
}
ret = glusterd_volume_defrag_restart (volinfo, op_errstr, PATH_MAX,
- volinfo->rebal.defrag_cmd, NULL);
+ volinfo->rebal.defrag_cmd,
+ volinfo->rebal.op == GD_OP_REMOVE_BRICK ?
+ glusterd_remove_brick_migrate_cbk : NULL);
+ if (!ret) {
+ /* If remove brick is started then ensure that on a glusterd
+ * restart decommission_is_in_progress is set to avoid remove
+ * brick commit to happen when rebalance is not completed.
+ */
+ if (volinfo->rebal.op == GD_OP_REMOVE_BRICK &&
+ volinfo->rebal.defrag_status == GF_DEFRAG_STATUS_STARTED) {
+ volinfo->decommission_in_progress = 1;
+ }
+ }
+
return ret;
}
int
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index ceb472284b2..3b7c82faab2 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -1170,4 +1170,8 @@ glusterd_handle_snap_limit (dict_t *dict, dict_t *rsp_dict);
gf_boolean_t
glusterd_should_i_stop_bitd ();
+int
+glusterd_remove_brick_migrate_cbk (glusterd_volinfo_t *volinfo,
+ gf_defrag_status_t status);
+
#endif