From 4474209781bef424993cc72afcc9e14183b6f1e2 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 21 Apr 2019 19:03:53 +0000 Subject: [PATCH] scst: Remove disabled code from scst_unregister_target() git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8267 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_main.c | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 3154c9c75..0ef9db751 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -550,11 +550,13 @@ out_free_tgt: } EXPORT_SYMBOL(scst_register_target); -/* - * scst_unregister_target() - unregister target. +/** + * scst_unregister_target() - unregister a target + * @tgt: Target to be unregistered. * - * It is supposed that no attempts to create new sessions for this - * target will be done in a race with this function. + * The caller is responsible for unregistration of all sessions associated + * with @tgt. Additionally, the caller must guarantee that no new sessions + * will be associated with @tgt while this function is in progress. */ void scst_unregister_target(struct scst_tgt *tgt) { @@ -575,28 +577,6 @@ void scst_unregister_target(struct scst_tgt *tgt) tgt->tgtt->release(tgt); TRACE_DBG("%s", "Target driver's release() returned"); -#if 0 /* Looks not needed. For scst_local it's bad, see this commit log message */ - mutex_lock(&scst_mutex); -again: - { - struct scst_session *sess; - - list_for_each_entry(sess, &tgt->sess_list, sess_list_entry) { - if (sess->shut_phase == SCST_SESS_SPH_READY) { - /* - * Sometimes it's hard for target driver to - * track all its sessions, so let's help it. - */ - mutex_unlock(&scst_mutex); - scst_unregister_session(sess, 0, NULL); - mutex_lock(&scst_mutex); - goto again; - } - } - } - mutex_unlock(&scst_mutex); -#endif - /* * Testing tgt->sysfs_sess_list below without holding scst_mutex * is safe, because: