summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-common.c
diff options
context:
space:
mode:
authorDan Lambright <dlambrig@redhat.com>2015-05-28 14:00:37 -0400
committerVijay Bellur <vbellur@redhat.com>2015-06-01 11:12:38 -0700
commit3f11b8e8ec6d78ebe33636b64130d5d133729f2c (patch)
tree276b368bc886f38661981ab7cb9ff791983fdca9 /xlators/cluster/dht/src/dht-common.c
parenteeb356584897ff778ffcbacff1c71d35d277b726 (diff)
cluster/dht: maintain start state of rebalance daemon across graph switch.
When we did a graph switch on a rebalance daemon, a second call to gf_degrag_start() was done. This lead to multiple threads doing migration. When multiple threads try to move the same file there can be deadlocks. Change-Id: I931ca7fe600022f245e3dccaabb1ad004f732c56 BUG: 1226005 Signed-off-by: Dan Lambright <dlambrig@redhat.com> Reviewed-on: http://review.gluster.org/10977 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.c')
-rw-r--r--xlators/cluster/dht/src/dht-common.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index d42ef867e2b..83aa9a26f4f 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -24,6 +24,8 @@
#include <libgen.h>
#include <signal.h>
+int run_defrag = 0;
+
int dht_link2 (xlator_t *this, call_frame_t *frame, int op_ret);
int
@@ -6892,11 +6894,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);