From f7d9814dc16d3a0e1468e7946a9e185cc76246df Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Mon, 2 May 2016 19:38:55 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/14152 Tested-by: Prasanna Kumar Kalever NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Smoke: Gluster Build System Reviewed-by: Joseph Fernandes Reviewed-by: Dan Lambright --- xlators/cluster/dht/src/tier.c | 7 +++++-- 1 file 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); -- cgit