diff options
author | Bart Van Assche <bart.vanassche@wdc.com> | 2018-06-22 14:52:53 -0700 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-07-02 16:44:31 -0400 |
commit | 00d909a10710a3416272d4179adf3837b9a9f3c2 (patch) | |
tree | d1ddbaa132791841c7b3c9659553317a9b058358 /include/media | |
parent | d1bff07f387c05cfaba1ea505fc2ee5eac6b2c21 (diff) | |
download | linux-stable-00d909a10710a3416272d4179adf3837b9a9f3c2.tar.gz linux-stable-00d909a10710a3416272d4179adf3837b9a9f3c2.tar.bz2 linux-stable-00d909a10710a3416272d4179adf3837b9a9f3c2.zip |
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 0f4a943168f3 ("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
(https://github.com/bvanassche/linux/commit/8df5463d7d7619f2f1b70cfe5172eaef0aa52815).
* 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>
Diffstat (limited to 'include/media')
0 files changed, 0 insertions, 0 deletions