[stgt] [PATCH] fix incorrect logical unit handling

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Fri Nov 27 10:37:08 CET 2009


Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
---
 usr/scsi.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/usr/scsi.c b/usr/scsi.c
index bf39328..cef231b 100644
--- a/usr/scsi.c
+++ b/usr/scsi.c
@@ -204,6 +204,19 @@ int scsi_cmd_perform(int host_no, struct scsi_cmd *cmd)
 		return SAM_STAT_CHECK_CONDITION;
 	}
 
+	if (cmd->dev->lun != cmd->dev_id) {
+		switch (op) {
+		case INQUIRY:
+			break;
+		case REQUEST_SENSE:
+			sense_data_build(cmd, ILLEGAL_REQUEST, ASC_LUN_NOT_SUPPORTED);
+			return SAM_STAT_GOOD;
+		default:
+			sense_data_build(cmd, ILLEGAL_REQUEST, ASC_LUN_NOT_SUPPORTED);
+			return SAM_STAT_CHECK_CONDITION;
+		}
+	}
+
 	/* check out Unit Attention condition */
 	switch (op) {
 	case INQUIRY:
-- 
1.5.6.5

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



More information about the stgt mailing list