diff options
author | Dan Lambright <dlambrig@redhat.com> | 2015-09-01 20:08:15 -0400 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-09-02 05:40:14 -0700 |
commit | 44dc74645144bfbca4aa0f08e36972359645a42c (patch) | |
tree | c3a771125ece813c62668956c3f057cf83e1cfe9 /xlators | |
parent | 37eeb91bd0154fcba0b0d4ebde8520c232c97512 (diff) |
cluster/dht: maintain start state of rebalance daemon across graph switch.
This is a backport of fix 10977.
> 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
Change-Id: I163d2d04692eba36c986ea9835f588962c92b93f
BUG: 1259078
Signed-off-by: Dan Lambright <dlambrig@redhat.com>
Reviewed-on: http://review.gluster.org/12082
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: mohammed rafi kc <rkavunga@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 15 |
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); |