Disable automatic sessions unregistration

Nowadays scst_local doesn't need anymore auto closing sessions on target
unregistration. Moreover, it can lead for it to the following Oops:

BUG at /home/bart/software/scst.git/scst/src/scst_targ.c:6293
------------[ cut here ]------------
kernel BUG at /home/bart/software/scst.git/scst/src/scst_targ.c:6293!
RIP: 0010:[<ffffffffa07c5110>]  [<ffffffffa07c5110>] scst_post_rx_mgmt_cmd+0x2b0/0x340 [scst]
Call Trace:
[<ffffffffa07c5289>] scst_rx_mgmt_fn+0xe9/0x3a0 [scst]
[<ffffffffa07cd75a>] scst_rx_mgmt_fn_lun.constprop.34+0x4a/0x60 [scst]
[<ffffffffa07cd804>] scst_unregister_session+0x94/0x250 [scst]
[<ffffffffa03c2ae8>] scst_local_release_adapter+0xa8/0x160 [scst_local]
[<ffffffff812ad42d>] device_release+0x3d/0xb0
[<ffffffff811f0db2>] kobject_cleanup+0x82/0x1b0
[<ffffffff811f0f1b>] kobject_put+0x2b/0x60
[<ffffffff812ad177>] put_device+0x17/0x20
[<ffffffffa00027e3>] scsi_host_dev_release+0xb3/0xe0 [scsi_mod]
[<ffffffff812ad42d>] device_release+0x3d/0xb0
[<ffffffff811f0db2>] kobject_cleanup+0x82/0x1b0
[<ffffffff811f0f1b>] kobject_put+0x2b/0x60
[<ffffffff812ad177>] put_device+0x17/0x20
[<ffffffffa000b2f2>] scsi_target_dev_release+0x22/0x30 [scsi_mod]
[<ffffffff812ad42d>] device_release+0x3d/0xb0
[<ffffffff811f0db2>] kobject_cleanup+0x82/0x1b0
[<ffffffff811f0f1b>] kobject_put+0x2b/0x60
[<ffffffff812ad177>] put_device+0x17/0x20
[<ffffffffa000ebd5>] scsi_device_dev_release_usercontext+0x1a5/0x1c0 [scsi_mod]
[<ffffffff8105d835>] execute_in_process_context+0x65/0x70
[<ffffffffa000e66c>] scsi_device_dev_release+0x1c/0x20 [scsi_mod]
[<ffffffff812ad42d>] device_release+0x3d/0xb0
[<ffffffff811f0db2>] kobject_cleanup+0x82/0x1b0
[<ffffffff811f0f1b>] kobject_put+0x2b/0x60
[<ffffffff812ad177>] put_device+0x17/0x20
[<ffffffffa0000ca4>] scsi_device_put+0x44/0x60 [scsi_mod]
[<ffffffffa00e58f9>] scsi_disk_put+0x39/0x50 [sd_mod]
[<ffffffffa00e62fb>] sd_release+0x4b/0xd0 [sd_mod]
[<ffffffff81175b2c>] __blkdev_put+0x16c/0x1c0
[<ffffffff813f4cf7>] ? _raw_spin_lock_irq+0x17/0x40
[<ffffffff81175bd7>] blkdev_put+0x57/0x130
[<ffffffff81175cd5>] blkdev_close+0x25/0x30
[<ffffffff8114042b>] __fput+0xdb/0x230
[<ffffffff811405ce>] ____fput+0xe/0x10
[<ffffffff810617d7>] task_work_run+0xa7/0xe0
[<ffffffff810028e9>] do_notify_resume+0x79/0xa0
[<ffffffff813fd930>] int_signal+0x12/0x17

So, experimantally disable this functionality.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5083 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2013-10-31 03:53:14 +00:00
parent 1e4010ce25
commit 6c9ea47b23
+15 -11
View File
@@ -613,7 +613,6 @@ static inline int test_sess_list(struct scst_tgt *tgt)
*/
void scst_unregister_target(struct scst_tgt *tgt)
{
struct scst_session *sess;
struct scst_tgt_template *vtt = tgt->tgtt;
#ifndef CONFIG_SCST_PROC
struct scst_acg *acg, *acg_tmp;
@@ -636,21 +635,26 @@ 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:
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 (see scst_local, eg), so let's help it.
*/
mutex_unlock(&scst_mutex);
scst_unregister_session(sess, 0, NULL);
mutex_lock(&scst_mutex);
goto 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
TRACE_DBG("%s", "Waiting for sessions shutdown");
wait_event(tgt->unreg_waitQ, test_sess_list(tgt));