From a61b47415cf1e6630c0177f2badb31bc5b86f62c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 21 Apr 2019 19:05:28 +0000 Subject: [PATCH] scst: Make scst_unregister_target() show which sessions it is waiting for git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8268 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_main.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 0ef9db751..ff3c4f12f 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -590,7 +590,19 @@ void scst_unregister_target(struct scst_tgt *tgt) * object. */ TRACE_DBG("%s", "Waiting for sessions shutdown"); - wait_event(tgt->unreg_waitQ, list_empty(&tgt->sysfs_sess_list)); + while (!wait_event_timeout(tgt->unreg_waitQ, + list_empty(&tgt->sysfs_sess_list), 60 * HZ)) { + struct scst_session *sess; + + mutex_lock(&scst_mutex); + list_for_each_entry(sess, &tgt->sess_list, sess_list_entry) { + PRINT_INFO("Still waiting for session %s/%s; state %ld; refcnt %#lx", + tgt->tgt_name, sess->sess_name, + sess->shut_phase, + atomic_long_read(&sess->refcnt.count)); + } + mutex_unlock(&scst_mutex); + } TRACE_DBG("%s", "wait_event() returned"); res = scst_suspend_activity(SCST_SUSPEND_TIMEOUT_UNLIMITED);