[stgt] [PATCH] REPORT SUPPORTED OPCODES: Only return opcodes supported by the backend.

Ronnie Sahlberg ronniesahlberg at gmail.com
Mon Nov 25 00:02:33 CET 2013


Signed-off-by: Ronnie Sahlberg <ronniesahlberg at gmail.com>
---
 usr/spc.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/usr/spc.c b/usr/spc.c
index 88fdf7d..9faa705 100644
--- a/usr/spc.c
+++ b/usr/spc.c
@@ -739,6 +739,9 @@ static int report_opcodes_all(struct scsi_cmd *cmd, int rctd,
 		if (ops[i].cmd_perform == spc_illegal_op)
 			continue;
 
+		if (!is_bs_support_opcode(cmd->dev->bst, i))
+			continue;
+
 		/* this command does not take a service action, so just
 		   report the opcode
 		*/
@@ -826,6 +829,9 @@ static int report_opcode_one(struct scsi_cmd *cmd, int rctd, uint8_t opcode,
 
 	ops = cmd->dev->dev_type_template.ops;
 
+	if (!is_bs_support_opcode(cmd->dev->bst, opcode))
+		return SAM_STAT_CHECK_CONDITION;
+
 	if ((is_service_action && !ops[opcode].service_actions)
 	||  (!is_service_action && ops[opcode].service_actions)) {
 		return SAM_STAT_CHECK_CONDITION;
-- 
1.7.3.1

--
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