linux/drivers/target
Mikulas Patocka 81a9c5e72b iscsi-target: fix iscsit_del_np deadlock on unload
On uniprocessor preemptible kernel, target core deadlocks on unload. The
following events happen:
* iscsit_del_np is called
* it calls send_sig(SIGINT, np->np_thread, 1);
* the scheduler switches to the np_thread
* the np_thread is woken up, it sees that kthread_should_stop() returns
  false, so it doesn't terminate
* the np_thread clears signals with flush_signals(current); and goes back
  to sleep in iscsit_accept_np
* the scheduler switches back to iscsit_del_np
* iscsit_del_np calls kthread_stop(np->np_thread);
* the np_thread is waiting in iscsit_accept_np and it doesn't respond to
  kthread_stop

The deadlock could be resolved if the administrator sends SIGINT signal to
the np_thread with killall -INT iscsi_np

The reproducible deadlock was introduced in commit
db6077fd0b, but the thread-stopping code was
racy even before.

This patch fixes the problem. Using kthread_should_stop to stop the
np_thread is unreliable, so we test np_thread_state instead. If
np_thread_state equals ISCSI_NP_THREAD_SHUTDOWN, the thread exits.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2014-06-27 23:23:35 -07:00
..
iscsi iscsi-target: fix iscsit_del_np deadlock on unload 2014-06-27 23:23:35 -07:00
loopback tcm_loop: Fix memory leak in tcm_loop_submission_work error path 2014-06-26 20:56:49 -07:00
sbp
tcm_fc tcm_fc: Generate TASK_SET_FULL status for response failures 2014-06-06 14:20:51 -07:00
Kconfig
Makefile
target_core_alua.c Merge branch 'next' (accumulated 3.16 merge window patches) into master 2014-06-08 11:31:16 -07:00
target_core_alua.h
target_core_configfs.c target: Fix alua_access_state attribute OOPs for un-configured devices 2014-06-06 01:22:41 -07:00
target_core_device.c target: Fix left-over se_lun->lun_sep pointer OOPs 2014-06-26 20:56:49 -07:00
target_core_fabric_configfs.c
target_core_fabric_lib.c
target_core_file.c
target_core_file.h
target_core_hba.c
target_core_iblock.c arch: Mass conversion of smp_mb__*() 2014-04-18 14:20:48 +02:00
target_core_iblock.h
target_core_internal.h
target_core_pr.c arch: Mass conversion of smp_mb__*() 2014-04-18 14:20:48 +02:00
target_core_pr.h
target_core_pscsi.c block: add blk_rq_set_block_pc() 2014-06-06 07:57:37 -06:00
target_core_pscsi.h
target_core_rd.c
target_core_rd.h
target_core_sbc.c TARGET/sbc,loopback: Adjust command data length in case pi exists on the wire 2014-06-11 13:06:50 -07:00
target_core_spc.c target: Report correct response length for some commands 2014-06-11 12:15:30 -07:00
target_core_stat.c
target_core_tmr.c
target_core_tpg.c
target_core_transport.c Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2014-06-12 22:38:32 -07:00
target_core_ua.c arch: Mass conversion of smp_mb__*() 2014-04-18 14:20:48 +02:00
target_core_ua.h
target_core_xcopy.c target: cleanup some boolean tests 2014-06-06 14:21:01 -07:00
target_core_xcopy.h