From 6a163b22144a689cd89a6a605715959e654ea015 Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Thu, 5 Dec 2013 11:16:55 +0530 Subject: dht: Set status to FAILED when rebalance stops due to brick going down Change-Id: I98da41342127b1690d887a5bc025e4c9dd504894 BUG: 1038452 Signed-off-by: Kaushal M Reviewed-on: http://review.gluster.org/6435 Tested-by: Gluster Build System Reviewed-by: Shishir Gowda Reviewed-by: Vijay Bellur --- xlators/cluster/dht/src/dht-common.c | 6 ++++-- xlators/cluster/dht/src/dht-common.h | 3 ++- xlators/cluster/dht/src/dht-rebalance.c | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'xlators/cluster') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 110e3eebb..898f41f0e 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -5078,7 +5078,8 @@ dht_notify (xlator_t *this, int event, void *data, ...) gf_log (this->name, GF_LOG_WARNING, "Received CHILD_DOWN. Exiting"); if (conf->defrag) { - gf_defrag_stop (conf->defrag, NULL); + gf_defrag_stop (conf->defrag, + GF_DEFRAG_STATUS_FAILED, NULL); } else { kill (getpid(), SIGTERM); } @@ -5154,7 +5155,8 @@ dht_notify (xlator_t *this, int event, void *data, ...) if (cmd == GF_DEFRAG_CMD_STATUS) gf_defrag_status_get (defrag, output); else if (cmd == GF_DEFRAG_CMD_STOP) - gf_defrag_stop (defrag, output); + gf_defrag_stop (defrag, + GF_DEFRAG_STATUS_STOPPED, output); } unlock: UNLOCK (&defrag->lock); diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 0497352e9..d391b87d5 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -732,7 +732,8 @@ int gf_defrag_status_get (gf_defrag_info_t *defrag, dict_t *dict); int -gf_defrag_stop (gf_defrag_info_t *defrag, dict_t *output); +gf_defrag_stop (gf_defrag_info_t *defrag, gf_defrag_status_t status, + dict_t *output); void* gf_defrag_start (void *this); diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index c123a4425..3e471edca 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -1801,7 +1801,8 @@ out: } int -gf_defrag_stop (gf_defrag_info_t *defrag, dict_t *output) +gf_defrag_stop (gf_defrag_info_t *defrag, gf_defrag_status_t status, + dict_t *output) { /* TODO: set a variable 'stop_defrag' here, it should be checked in defrag loop */ @@ -1813,7 +1814,7 @@ gf_defrag_stop (gf_defrag_info_t *defrag, dict_t *output) } gf_log ("", GF_LOG_INFO, "Received stop command on rebalance"); - defrag->defrag_status = GF_DEFRAG_STATUS_STOPPED; + defrag->defrag_status = status; if (output) gf_defrag_status_get (defrag, output); -- cgit