From e63a0dcbd00a8f3f25b72e4593fbb1e3841d7a1f Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Tue, 12 Dec 2006 09:18:04 +0000 Subject: [PATCH] Take 2 of fixing the race, which could lead to BUG() in scst_mgmt_thread() git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@45 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_targ.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 0e5c416fd..2f995e0bd 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -3861,17 +3861,15 @@ restart: list_for_each_entry(sess, &scst_sess_mgmt_list, sess_mgmt_list_entry) { - int shutting_down; TRACE_DBG("Removing sess %p from scst_sess_mgmt_list", sess); list_del(&sess->sess_mgmt_list_entry); - shutting_down = sess->shutting_down; spin_unlock_irq(&scst_mgmt_lock); - if (shutting_down) { + if (sess->init_phase == SCST_SESS_IPH_INITING) { + scst_init_session(sess); + } else if (sess->shutting_down) { BUG_ON(atomic_read(&sess->refcnt) != 0); scst_free_session_callback(sess); - } else if (sess->init_phase == SCST_SESS_IPH_INITING) { - scst_init_session(sess); } else { PRINT_ERROR_PR("session %p is in " "scst_sess_mgmt_list, but in unknown "