summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSusant Palai <spalai@redhat.com>2016-04-15 05:15:33 -0400
committerJeff Darcy <jdarcy@redhat.com>2016-04-25 07:31:27 -0700
commit61b42d3cdc2962101f5976f89c28de381b3525aa (patch)
tree6744135bd35ba1616b0b2272f1e7b2cc9bde14de
parent3021a9ab666e9f1a5116df84e77659aca613e955 (diff)
dht/rebalance: Handle GF_DEFRAG_STOP
Problem: On a rebal stop, the migrator threads don't intimate the crawler thread to wake up in case it is waiting on signal from migrator thread. Change-Id: I3cc4be41a4db25f48fee059ebb79a97ee99dcd00 BUG: 1327507 Signed-off-by: Susant Palai <spalai@redhat.com> Reviewed-on: http://review.gluster.org/14004 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: N Balachandran <nbalacha@redhat.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index a026a0e1cd1..3ddfbb3534b 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -2070,6 +2070,10 @@ gf_defrag_task (void *opaque)
while (_gf_true) {
if (defrag->defrag_status != GF_DEFRAG_STATUS_STARTED) {
+ pthread_cond_broadcast (
+ &defrag->rebalance_crawler_alarm);
+ pthread_cond_broadcast (
+ &defrag->parallel_migration_cond);
goto out;
}
@@ -2133,6 +2137,13 @@ gf_defrag_task (void *opaque)
defrag->defrag_status =
GF_DEFRAG_STATUS_FAILED;
+
+ pthread_cond_broadcast (
+ &defrag->rebalance_crawler_alarm);
+
+ pthread_cond_broadcast (
+ &defrag->parallel_migration_cond);
+
goto out;
}
@@ -2191,10 +2202,16 @@ gf_defrag_get_entry (xlator_t *this, int i, struct dht_container **container,
xlator_t *hashed_subvol = NULL;
xlator_t *cached_subvol = NULL;
+ if (defrag->defrag_status != GF_DEFRAG_STATUS_STARTED) {
+ ret = -1;
+ goto out;
+ }
+
if (dir_dfmeta->offset_var[i].readdir_done == 1) {
ret = 0;
goto out;
}
+
if (dir_dfmeta->fetch_entries[i] == 1) {
ret = syncop_readdirp (conf->local_subvols[i], fd, 131072,
dir_dfmeta->offset_var[i].offset,