summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2016-05-02 19:38:55 +0530
committerDan Lambright <dlambrig@redhat.com>2016-05-11 16:59:49 -0700
commitf7d9814dc16d3a0e1468e7946a9e185cc76246df (patch)
treef10d77673851167f78555bce609520b278ba828b /xlators/cluster
parentb2222c1e13d3bff17fa04b8f9b4870cefd457fe2 (diff)
tier: avoid pthread_join if pthread_create fails
this patch rearrange the code, to add some defence functionality for pthread_create(), i.e. only on a success on pthread_create() call pthread_join(). Change-Id: I0836bc950a210574cfdc755a666c6ac5df6ab430 BUG: 1332219 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> Reviewed-on: http://review.gluster.org/14152 Tested-by: Prasanna Kumar Kalever <pkalever@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Joseph Fernandes Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/dht/src/tier.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c
index 1484589bc47..a0fe12179a4 100644
--- a/xlators/cluster/dht/src/tier.c
+++ b/xlators/cluster/dht/src/tier.c
@@ -1924,7 +1924,7 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
DHT_MSG_LOG_TIER_ERROR,
"Failed to start demotion thread.");
defrag->defrag_status = GF_DEFRAG_STATUS_FAILED;
- goto out;
+ goto cleanup;
}
tier_get_bricklist (conf->subvolumes[0], &bricklist_cold);
@@ -1943,12 +1943,15 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
DHT_MSG_LOG_TIER_ERROR,
"Failed to start promotion thread.");
defrag->defrag_status = GF_DEFRAG_STATUS_FAILED;
+ goto waitforspawned;
}
-out:
pthread_join (promote_thread, NULL);
+
+waitforspawned:
pthread_join (demote_thread, NULL);
+cleanup:
clear_bricklist (&bricklist_cold);
clear_bricklist (&bricklist_hot);