diff mbox

target: improve unsupported opcode message

Message ID 1437602500-3793-1-git-send-email-sbaugh@catern.com (mailing list archive)
State New, archived
Headers show

Commit Message

Spencer Baugh July 22, 2015, 10:01 p.m. UTC
From: Joern Engel <joern@purestorage.com>

Make the warning about unsupported SCSI opcode more useful:

 - Add in the initiator name so we know who's sending it.
 - Print the warning even for opcodes that spc_parse_cdb() knows about
   but that we don't handle.

Signed-off-by: Joern Engel <joern@purestorage.com>
Signed-off-by: Spencer Baugh <sbaugh@catern.com>
---
 drivers/target/target_core_spc.c       | 3 ---
 drivers/target/target_core_transport.c | 5 +++++
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Christoph Hellwig July 23, 2015, 9:39 a.m. UTC | #1
Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sagi Grimberg July 23, 2015, 9:57 a.m. UTC | #2
On 7/23/2015 1:01 AM, Spencer Baugh wrote:
> From: Joern Engel <joern@purestorage.com>
>
> Make the warning about unsupported SCSI opcode more useful:
>
>   - Add in the initiator name so we know who's sending it.
>   - Print the warning even for opcodes that spc_parse_cdb() knows about
>     but that we don't handle.
>
> Signed-off-by: Joern Engel <joern@purestorage.com>
> Signed-off-by: Spencer Baugh <sbaugh@catern.com>

Looks good,

Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nicholas A. Bellinger July 31, 2015, 6:46 a.m. UTC | #3
On Wed, 2015-07-22 at 15:01 -0700, Spencer Baugh wrote:
> From: Joern Engel <joern@purestorage.com>
> 
> Make the warning about unsupported SCSI opcode more useful:
> 
>  - Add in the initiator name so we know who's sending it.
>  - Print the warning even for opcodes that spc_parse_cdb() knows about
>    but that we don't handle.
> 
> Signed-off-by: Joern Engel <joern@purestorage.com>
> Signed-off-by: Spencer Baugh <sbaugh@catern.com>
> ---
>  drivers/target/target_core_spc.c       | 3 ---
>  drivers/target/target_core_transport.c | 5 +++++
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
> index b074443..87d4adb 100644
> --- a/drivers/target/target_core_spc.c
> +++ b/drivers/target/target_core_spc.c
> @@ -1405,9 +1405,6 @@ spc_parse_cdb(struct se_cmd *cmd, unsigned int *size)
>  		}
>  		break;
>  	default:
> -		pr_warn("TARGET_CORE[%s]: Unsupported SCSI Opcode"
> -			" 0x%02x, sending CHECK_CONDITION.\n",
> -			cmd->se_tfo->get_fabric_name(), cdb[0]);
>  		return TCM_UNSUPPORTED_SCSI_OPCODE;
>  	}
>  
> diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
> index ce8574b..ac002a7 100644
> --- a/drivers/target/target_core_transport.c
> +++ b/drivers/target/target_core_transport.c
> @@ -1246,6 +1246,11 @@ target_setup_cmd_from_cdb(struct se_cmd *cmd, unsigned char *cdb)
>  	}
>  
>  	ret = dev->transport->parse_cdb(cmd);
> +	if (ret == TCM_UNSUPPORTED_SCSI_OPCODE)
> +		pr_warn_ratelimited("%s/%s: Unsupported SCSI Opcode 0x%02x, sending CHECK_CONDITION.\n",
> +				    cmd->se_tfo->get_fabric_name(),
> +				    cmd->se_sess->se_node_acl->initiatorname,
> +				    cmd->t_task_cdb[0]);
>  	if (ret)
>  		return ret;
>  

Applied to target-pending/for-next.

Thanks Joern + Spencer!

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

Patch

diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
index b074443..87d4adb 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -1405,9 +1405,6 @@  spc_parse_cdb(struct se_cmd *cmd, unsigned int *size)
 		}
 		break;
 	default:
-		pr_warn("TARGET_CORE[%s]: Unsupported SCSI Opcode"
-			" 0x%02x, sending CHECK_CONDITION.\n",
-			cmd->se_tfo->get_fabric_name(), cdb[0]);
 		return TCM_UNSUPPORTED_SCSI_OPCODE;
 	}
 
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index ce8574b..ac002a7 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1246,6 +1246,11 @@  target_setup_cmd_from_cdb(struct se_cmd *cmd, unsigned char *cdb)
 	}
 
 	ret = dev->transport->parse_cdb(cmd);
+	if (ret == TCM_UNSUPPORTED_SCSI_OPCODE)
+		pr_warn_ratelimited("%s/%s: Unsupported SCSI Opcode 0x%02x, sending CHECK_CONDITION.\n",
+				    cmd->se_tfo->get_fabric_name(),
+				    cmd->se_sess->se_node_acl->initiatorname,
+				    cmd->t_task_cdb[0]);
 	if (ret)
 		return ret;