From 82bb93410fc6f74e32ad74339ece5b4f62dc9967 Mon Sep 17 00:00:00 2001 From: Chris Horn Date: Thu, 20 Feb 2020 18:01:45 -0600 Subject: [PATCH] LU-13277 lnet: Discovery thread can deadlock on shutdown Drop the net_lock/EX before breaking out of the loop to avoid deadlock. Cray-bug-id: LUS-8525 Signed-off-by: Chris Horn Change-Id: Ie62b55fa45b5795937eb1480a1fcabe295fed0ee Reviewed-on: https://review.whamcloud.com/37675 Reviewed-by: Amir Shehata Tested-by: jenkins Reviewed-by: Serguei Smirnov Tested-by: Maloo Reviewed-by: Shaun Tancheff Reviewed-by: Oleg Drokin --- lnet/lnet/peer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lnet/lnet/peer.c b/lnet/lnet/peer.c index 5ea9206..fe4f028 100644 --- a/lnet/lnet/peer.c +++ b/lnet/lnet/peer.c @@ -3291,8 +3291,10 @@ static int lnet_peer_discovery(void *arg) lnet_push_target_resize(); lnet_net_lock(LNET_LOCK_EX); - if (the_lnet.ln_dc_state == LNET_DC_STATE_STOPPING) + if (the_lnet.ln_dc_state == LNET_DC_STATE_STOPPING) { + lnet_net_unlock(LNET_LOCK_EX); break; + } /* * Process all incoming discovery work requests. When -- 1.8.3.1