diff mbox

[RFC,13/13] target: translate TCM_OUT_OF_RESOURCES to SAM_STAT_TASK_SET_FULL

Message ID 1496263970-7632-14-git-send-email-mchristi@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mike Christie May 31, 2017, 8:52 p.m. UTC
It seemed like TCM_OUT_OF_RESOURCES was not supposed to be a hard
failure like TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE. This patch
translates TCM_OUT_OF_RESOURCES  to SAM_STAT_TASK_SET_FULL so it
can be retried by the initiator.

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 drivers/target/target_core_transport.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index faad7b4..79c9cbe 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1692,8 +1692,8 @@  void transport_generic_request_failure(struct se_cmd *cmd,
 	case TCM_UNSUPPORTED_SEGMENT_DESC_TYPE_CODE:
 		break;
 	case TCM_OUT_OF_RESOURCES:
-		sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
-		break;
+		scsi_status = SAM_STAT_TASK_SET_FULL;
+		goto queue_completion;
 	case TCM_RESERVATION_CONFLICT:
 		/*
 		 * No SENSE Data payload for this case, set SCSI Status
@@ -2114,7 +2114,12 @@  static void target_complete_cmd_work(struct work_struct *work)
 
 				return;
 			} else if (rc && good) {
-				transport_setup_sense(cmd, rc);
+				if (rc == TCM_OUT_OF_RESOURCES) {
+					cmd->scsi_status =
+							SAM_STAT_TASK_SET_FULL;
+				} else {
+					transport_setup_sense(cmd, rc);
+				}
 			}
 		}
 	}