linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-v2 1/2] target: Avoid DataIN transfers for non-GOOD SAM status
@ 2016-03-05  7:07 Nicholas A. Bellinger
  2016-03-05  7:07 ` [PATCH-v2 2/2] target/iblock: Use -EAGAIN/-ENOMEM to propigate SAM BUSY/TASK_SET_FULL Nicholas A. Bellinger
  2016-03-05 21:01 ` [PATCH-v2 1/2] target: Avoid DataIN transfers for non-GOOD SAM status Christoph Hellwig
  0 siblings, 2 replies; 14+ messages in thread
From: Nicholas A. Bellinger @ 2016-03-05  7:07 UTC (permalink / raw)
  To: target-devel, linux-scsi
  Cc: Hannes Reinecke, Christoph Hellwig, Mike Christie, Sagi Grimberg,
	Andy Grover, Nicholas Bellinger, Sagi Grimberg, Mike Christie

From: Nicholas Bellinger <nab@linux-iscsi.org>

This patch modifies existing transport_complete_*() code
to avoid invoking target_core_fabric_ops->queue_data_in()
driver callbacks for I/O READs with non-GOOD SAM status.

Some initiators expect GOOD status when a DATA-IN payload
transfer is involved, so to be safe go ahead and always
invoke target_core_fabric_ops->queue_status() to generate
fabric responses instead.

Note this is a prerequisite for IBLOCK supporting retriable
status, so SAM_STAT_BUSY + SAM_STAT_TASK_SET_FULL always
generates fabric driver responses instead of initiating
DataIN payload transfer when non-GOOD status is present

Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Andy Grover <agrover@redhat.com>
Cc: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
---
 drivers/target/target_core_transport.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index f5ad9e0..784dd22 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1997,6 +1997,9 @@ static void transport_complete_qf(struct se_cmd *cmd)
 
 	switch (cmd->data_direction) {
 	case DMA_FROM_DEVICE:
+		if (cmd->scsi_status)
+			goto queue_status;
+
 		trace_target_cmd_complete(cmd);
 		ret = cmd->se_tfo->queue_data_in(cmd);
 		break;
@@ -2007,6 +2010,7 @@ static void transport_complete_qf(struct se_cmd *cmd)
 		}
 		/* Fall through for DMA_TO_DEVICE */
 	case DMA_NONE:
+queue_status:
 		trace_target_cmd_complete(cmd);
 		ret = cmd->se_tfo->queue_status(cmd);
 		break;
@@ -2128,6 +2132,9 @@ static void target_complete_ok_work(struct work_struct *work)
 queue_rsp:
 	switch (cmd->data_direction) {
 	case DMA_FROM_DEVICE:
+		if (cmd->scsi_status)
+			goto queue_status;
+
 		atomic_long_add(cmd->data_length,
 				&cmd->se_lun->lun_stats.tx_data_octets);
 		/*
@@ -2167,6 +2174,7 @@ queue_rsp:
 		}
 		/* Fall through for DMA_TO_DEVICE */
 	case DMA_NONE:
+queue_status:
 		trace_target_cmd_complete(cmd);
 		ret = cmd->se_tfo->queue_status(cmd);
 		if (ret == -EAGAIN || ret == -ENOMEM)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-03-08  7:04 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-05  7:07 [PATCH-v2 1/2] target: Avoid DataIN transfers for non-GOOD SAM status Nicholas A. Bellinger
2016-03-05  7:07 ` [PATCH-v2 2/2] target/iblock: Use -EAGAIN/-ENOMEM to propigate SAM BUSY/TASK_SET_FULL Nicholas A. Bellinger
2016-03-05 21:01   ` Christoph Hellwig
2016-03-05 22:51     ` Nicholas A. Bellinger
2016-03-06  6:19       ` Christoph Hellwig
2016-03-06 21:55         ` Nicholas A. Bellinger
2016-03-07  7:55           ` Christoph Hellwig
2016-03-07  8:03             ` Nicholas A. Bellinger
2016-03-07 16:18               ` -EAGAIN and -ENOMEM from ->bi_end_io, was " Christoph Hellwig
2016-03-07 22:39                 ` Nicholas A. Bellinger
2016-03-08  7:04                   ` Christoph Hellwig
2016-03-07 16:40               ` James Bottomley
2016-03-07 22:44                 ` Nicholas A. Bellinger
2016-03-05 21:01 ` [PATCH-v2 1/2] target: Avoid DataIN transfers for non-GOOD SAM status Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).