All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@wdc.com>
To: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org,
	"Nicholas A . Bellinger" <nab@linux-iscsi.org>
Cc: "Martin K . Petersen" <martin.petersen@oracle.com>,
	Hannes Reinecke <hare@suse.de>,
	Bart Van Assche <bart.vanassche@sandisk.com>
Subject: [PATCH 5/5] target: core: Fix failed command sense data handling
Date: Wed, 28 Jun 2017 14:59:00 +0900	[thread overview]
Message-ID: <20170628055900.22889-6-damien.lemoal@wdc.com> (raw)
In-Reply-To: <20170628055900.22889-1-damien.lemoal@wdc.com>

For a target device without a transport->transport_complete method
defined (e.g. target_core_user), target_complete_cmd() will always
result in a failed command completion being processed through target
failure completion work even when the command failure comes from the
target processing and has valid sense data (and hence does not require
sense data emulation as done in the failure work processing). To ensure
that the failed command sense data is propagated as indicated by the
target, make sure that the normal "ok" work completion path is used by
moving the command SCF_TRANSPORT_TASK_SENSE flag test out of the
transport_complete defined conditional.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 drivers/target/target_core_transport.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index f1b3a46..a18e4db 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -719,10 +719,11 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status)
 		dev->transport->transport_complete(cmd,
 				cmd->t_data_sg,
 				transport_get_sense_buffer(cmd));
-		if (cmd->se_cmd_flags & SCF_TRANSPORT_TASK_SENSE)
-			success = 1;
 	}
 
+	if (cmd->se_cmd_flags & SCF_TRANSPORT_TASK_SENSE)
+		success = 1;
+
 	/*
 	 * Check for case where an explicit ABORT_TASK has been received
 	 * and transport_wait_for_tasks() will be waiting for completion..
-- 
2.9.4

  parent reply	other threads:[~2017-06-28  5:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28  5:58 [PATCH 0/5] target: Zoned block device support and bug fixes Damien Le Moal
2017-06-28  5:58 ` [PATCH 1/5] target: Use macro for WRITE_VERIFY_xx operation codes Damien Le Moal
2017-07-07  5:00   ` Nicholas A. Bellinger
2017-06-28  5:58 ` [PATCH 2/5] target: pscsi: Introduce TYPE_ZBC support Damien Le Moal
2017-07-07  5:00   ` Nicholas A. Bellinger
2017-06-28  5:58 ` [PATCH 3/5] target: pscsi: Fix sense data handling Damien Le Moal
2017-07-07  5:02   ` Nicholas A. Bellinger
2017-06-28  5:58 ` [PATCH 4/5] target: user: " Damien Le Moal
2017-06-28 17:44   ` Mike Christie
2017-06-29  2:26     ` Damien Le Moal
2017-07-07  4:50     ` Nicholas A. Bellinger
2017-07-07  5:14       ` Damien Le Moal
2017-07-07  6:05         ` Nicholas A. Bellinger
2017-07-07  6:06           ` Nicholas A. Bellinger
2017-07-07  6:18             ` Damien Le Moal
2017-07-10  5:36           ` Damien Le Moal
2017-07-10 17:26             ` Mike Christie
2017-07-11  0:57               ` Damien Le Moal
2017-07-07 17:19       ` Mike Christie
2017-07-07  5:04   ` Nicholas A. Bellinger
2017-06-28  5:59 ` Damien Le Moal [this message]
2017-06-28 17:45   ` [PATCH 5/5] target: core: Fix failed command " Mike Christie
2017-07-07  5:06   ` Nicholas A. Bellinger
2017-06-28 14:34 ` [PATCH 0/5] target: Zoned block device support and bug fixes Bryant G. Ly
2017-06-29  2:24   ` Damien Le Moal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170628055900.22889-6-damien.lemoal@wdc.com \
    --to=damien.lemoal@wdc.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nab@linux-iscsi.org \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.