diff mbox

[v6,06/33] target: Fix handling of aborted failed commands

Message ID 20170215002612.14566-7-bart.vanassche@sandisk.com (mailing list archive)
State Superseded
Headers show

Commit Message

Bart Van Assche Feb. 15, 2017, 12:25 a.m. UTC
If a target driver (e.g. tcm_qla2xxx) calls
transport_generic_request_failure() to report that receiving data
has failed and that SCSI command has already been aborted by the
initiator, ensure that the SCSI status ABORTED is sent back to the
initiator instead of the sense code provided by the target driver.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: David Disseldorp <ddiss@suse.de>
---
 drivers/target/target_core_transport.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Nicholas A. Bellinger Feb. 20, 2017, 9:27 p.m. UTC | #1
On Tue, 2017-02-14 at 16:25 -0800, Bart Van Assche wrote:
> If a target driver (e.g. tcm_qla2xxx) calls
> transport_generic_request_failure() to report that receiving data
> has failed and that SCSI command has already been aborted by the
> initiator, ensure that the SCSI status ABORTED is sent back to the
> initiator instead of the sense code provided by the target driver.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: David Disseldorp <ddiss@suse.de>
> ---
>  drivers/target/target_core_transport.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
> index 22190003534d..efb9e6f38201 100644
> --- a/drivers/target/target_core_transport.c
> +++ b/drivers/target/target_core_transport.c
> @@ -1647,6 +1647,9 @@ void transport_generic_request_failure(struct se_cmd *cmd,
>  {
>  	int ret = 0, post_ret = 0;
>  
> +	if (transport_check_aborted_status(cmd, 1))
> +		return;
> +
>  	pr_debug("-----[ Storage Engine Exception for cmd: %p ITT: 0x%08llx"
>  		" CDB: 0x%02x\n", cmd, cmd->tag, cmd->t_task_cdb[0]);
>  	pr_debug("-----[ i_state: %d t_state: %d sense_reason: %d\n",

Nice catch.  AFAICT it should be OK to return here and not call
transport_cmd_check_stop_to_fabric() directly, considering CMD_T_ABORTED
commands will already be dropping all outstanding cmd->cmd_kref
references in target_core_tmr.c code.

Applied to target-pending/for-next.

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 22190003534d..efb9e6f38201 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1647,6 +1647,9 @@  void transport_generic_request_failure(struct se_cmd *cmd,
 {
 	int ret = 0, post_ret = 0;
 
+	if (transport_check_aborted_status(cmd, 1))
+		return;
+
 	pr_debug("-----[ Storage Engine Exception for cmd: %p ITT: 0x%08llx"
 		" CDB: 0x%02x\n", cmd, cmd->tag, cmd->t_task_cdb[0]);
 	pr_debug("-----[ i_state: %d t_state: %d sense_reason: %d\n",