summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.c')
-rw-r--r--xlators/cluster/dht/src/dht-common.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 82a4c392b5a..f83ff6487a2 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -29,7 +29,11 @@
#include <libgen.h>
#include <signal.h>
-int dht_link2 (xlator_t *this, xlator_t *dst_node, call_frame_t *frame);
+int run_defrag = 0;
+
+int
+dht_link2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame);
+
int
dht_removexattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame);
@@ -7604,11 +7608,16 @@ unlock:
}
}
- /* rebalance is started with assert_no_child_down. So we do
+ /* Rebalance is started with assert_no_child_down. So we do
* not need to handle CHILD_DOWN event here.
+ *
+ * If there is a graph switch, we should not restart the
+ * rebalance daemon. Use 'run_defrag' to indicate if the
+ * thread has already started.
*/
- if (conf->defrag) {
+ if (conf->defrag && !run_defrag) {
if (methods->migration_needed(this)) {
+ run_defrag = 1;
ret = gf_thread_create(&conf->defrag->th,
NULL,
gf_defrag_start, this);