alistair23-linux/drivers/target
Bart Van Assche 00d909a107 scsi: target: Make the session shutdown code also wait for commands that are being aborted
Target drivers must call target_sess_cmd_list_set_waiting() and
target_wait_for_sess_cmds() before freeing a session. Since freeing a
session is only safe after all commands that are associated with a session
have finished, make target_wait_for_sess_cmds() also wait for commands that
are being aborted. Instead of setting a flag in each pending command from
target_sess_cmd_list_set_waiting() and waiting in
target_wait_for_sess_cmds() on a per-command completion, only set a
per-session flag in the former function and wait on a per-session
completion in the latter function. This change is safe because once a SCSI
initiator system has submitted a command a target system is always allowed
to execute it to completion. See also commit 0f4a943168 ("target: Fix
remote-port TMR ABORT + se_cmd fabric stop").

This patch is based on the following two patches:

* Bart Van Assche, target: Simplify session shutdown code, February 19, 2015
  (8df5463d7d).

* Christoph Hellwig, target: Rework session shutdown code, December 7, 2015
  (http://thread.gmane.org/gmane.linux.scsi.target.devel/10695).

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Mike Christie <mchristi@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-07-02 16:44:31 -04:00
..
iscsi scsi: target: Rename transport_init_session() into transport_alloc_session() 2018-07-02 16:44:31 -04:00
loopback target/tcm_loop: Use blk_queue_flag_set() 2018-03-08 14:13:48 -07:00
sbp scsi: target: Convert target drivers to use sbitmap 2018-06-19 22:02:25 -04:00
tcm_fc scsi: target: Convert target drivers to use sbitmap 2018-06-19 22:02:25 -04:00
Kconfig
Makefile
target_core_alua.c
target_core_alua.h
target_core_configfs.c scsi: target: Use config_item_name() instead of open-coding it 2018-07-02 16:44:30 -04:00
target_core_device.c scsi: target: Avoid that EXTENDED COPY commands trigger lock inversion 2018-07-02 16:44:30 -04:00
target_core_fabric_configfs.c
target_core_fabric_lib.c
target_core_file.c scsi: target: target/file: Add support of direct and async I/O 2018-05-14 22:40:08 -04:00
target_core_file.h scsi: target: target/file: Add support of direct and async I/O 2018-05-14 22:40:08 -04:00
target_core_hba.c
target_core_iblock.c target: convert to bioset_init()/mempool_init() 2018-05-30 15:33:32 -06:00
target_core_iblock.h target: convert to bioset_init()/mempool_init() 2018-05-30 15:33:32 -06:00
target_core_internal.h scsi: target: prefer dbroot of /etc/target over /var/target 2018-04-19 00:47:02 -04:00
target_core_pr.c
target_core_pr.h
target_core_pscsi.c SCSI misc on 20180610 2018-06-10 13:01:12 -07:00
target_core_pscsi.h
target_core_rd.c
target_core_rd.h
target_core_sbc.c scsi: target: Use config_item_name() instead of open-coding it 2018-07-02 16:44:30 -04:00
target_core_spc.c
target_core_stat.c
target_core_tmr.c scsi: target: Make the session shutdown code also wait for commands that are being aborted 2018-07-02 16:44:31 -04:00
target_core_tpg.c
target_core_transport.c scsi: target: Make the session shutdown code also wait for commands that are being aborted 2018-07-02 16:44:31 -04:00
target_core_ua.c
target_core_ua.h
target_core_user.c scsi: tcmu: Don't pass KERN_ERR to pr_err 2018-06-26 12:55:08 -04:00
target_core_xcopy.c scsi: target: Introduce transport_init_session() 2018-07-02 16:44:31 -04:00
target_core_xcopy.h