summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-09-13 16:54:24 +0530
committerVijay Bellur <vijay@gluster.com>2011-09-13 09:55:26 -0700
commitb039cb193eddc51c6f31bf9a230281faada475fe (patch)
tree8d4aefbf3fda4366bb1e8699fd575e872f161f67 /xlators/mgmt/glusterd/src/glusterd-brick-ops.c
parent25daa42911d2ff697880ee29c591cac5f2abebed (diff)
glusterd rebalance: fix minor issues
there were bugs introduced due to parallelizing rebalance op. * argument to dict_set_str () should be static as for the life of dict * uuid_utoa() output should not be considered as static * overloading 'volinfo->defrag' in other nodes is a overkill, just KISS Change-Id: I43d00c8e22beb2dd5c5f9824552f7337543b2255 BUG: 2112 Reviewed-on: http://review.gluster.com/407 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-brick-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index 8832c69ed4f..66467373b5c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -945,7 +945,16 @@ glusterd_op_add_brick (dict_t *dict, char **op_errstr)
goto out;
}
- volinfo->defrag_status = 0;
+ /* Need to reset the defrag/rebalance status accordingly */
+ switch (volinfo->defrag_status) {
+ case GF_DEFRAG_STATUS_FAILED:
+ case GF_DEFRAG_STATUS_COMPLETE:
+ case GF_DEFRAG_STATUS_LAYOUT_FIX_COMPLETE:
+ case GF_DEFRAG_STATUS_MIGRATE_DATA_COMPLETE:
+ volinfo->defrag_status = 0;
+ default:
+ break;
+ }
ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT);
if (ret)
@@ -1006,9 +1015,6 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
case GF_OP_CMD_PAUSE:
{
if (volinfo->decommission_in_progress) {
- if (volinfo->defrag == (void *)1)
- volinfo->defrag = NULL;
-
if (volinfo->defrag) {
LOCK (&volinfo->defrag->lock);
@@ -1026,9 +1032,6 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
case GF_OP_CMD_ABORT:
{
if (volinfo->decommission_in_progress) {
- if (volinfo->defrag == (void *)1)
- volinfo->defrag = NULL;
-
if (volinfo->defrag) {
LOCK (&volinfo->defrag->lock);
@@ -1054,9 +1057,6 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
case GF_OP_CMD_COMMIT_FORCE:
if (volinfo->decommission_in_progress) {
- if (volinfo->defrag == (void *)1)
- volinfo->defrag = NULL;
-
if (volinfo->defrag) {
LOCK (&volinfo->defrag->lock);
/* Fake 'rebalance-complete' so the graph change
@@ -1109,7 +1109,16 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
goto out;
}
- volinfo->defrag_status = 0;
+ /* Need to reset the defrag/rebalance status accordingly */
+ switch (volinfo->defrag_status) {
+ case GF_DEFRAG_STATUS_FAILED:
+ case GF_DEFRAG_STATUS_COMPLETE:
+ case GF_DEFRAG_STATUS_LAYOUT_FIX_COMPLETE:
+ case GF_DEFRAG_STATUS_MIGRATE_DATA_COMPLETE:
+ volinfo->defrag_status = 0;
+ default:
+ break;
+ }
if (!force && need_rebalance) {
/* perform the rebalance operations */
ret = glusterd_handle_defrag_start (volinfo, err_str, 4096,