linux/drivers/target/iscsi
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_target_auth.c iscsi-target; Enforce 1024 byte maximum for CHAP_C key value 2014-06-26 20:56:42 -07:00
iscsi_target_auth.h iscsi-target: Fix CHAP_A parameter list handling 2014-06-05 19:44:02 -07:00
iscsi_target_configfs.c
iscsi_target_configfs.h
iscsi_target_core.h Target/iscsi,iser: Avoid accepting transport connections during stop stage 2014-05-15 17:09:11 -07:00
iscsi_target_datain_values.c
iscsi_target_datain_values.h
iscsi_target_device.c
iscsi_target_device.h
iscsi_target_erl0.c
iscsi_target_erl0.h
iscsi_target_erl1.c
iscsi_target_erl1.h
iscsi_target_erl2.c
iscsi_target_erl2.h
iscsi_target_login.c iscsi-target: fix iscsit_del_np deadlock on unload 2014-06-27 23:23:35 -07:00
iscsi_target_login.h
iscsi_target_nego.c target: cleanup some boolean tests 2014-06-06 14:21:01 -07:00
iscsi_target_nego.h
iscsi_target_nodeattrib.c
iscsi_target_nodeattrib.h
iscsi_target_parameters.c target: cleanup some boolean tests 2014-06-06 14:21:01 -07:00
iscsi_target_parameters.h
iscsi_target_seq_pdu_list.c
iscsi_target_seq_pdu_list.h
iscsi_target_stat.c
iscsi_target_stat.h
iscsi_target_tmr.c
iscsi_target_tmr.h
iscsi_target_tpg.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
iscsi_target_tpg.h iscsi-target: Remove no-op from iscsit_tpg_del_portal_group 2014-06-05 19:44:40 -07:00
iscsi_target_tq.c
iscsi_target_tq.h
iscsi_target_transport.c
iscsi_target_util.c iscsi-target: Explicily clear login response PDU in exception path 2014-06-26 20:56:49 -07:00
iscsi_target_util.h
iscsi_target.c iscsi-target: Avoid rejecting incorrect ITT for Data-Out 2014-06-27 11:47:57 -07:00
iscsi_target.h
Kconfig
Makefile