diff mbox series

target: iscsi: Fix zero tag inside a trace event

Message ID 20210403215415.95077-1-r.bolshakov@yadro.com
State New
Headers show
Series target: iscsi: Fix zero tag inside a trace event | expand

Commit Message

Roman Bolshakov April 3, 2021, 9:54 p.m. UTC
target_sequencer_start event is triggered inside target_cmd_init_cdb().
se_cmd.tag is not initialized with ITT at the moment so the event always
prints zero tag.

Cc: stable@vger.kernel.org # 5.10+
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
 drivers/target/iscsi/iscsi_target.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Mike Christie April 5, 2021, 3:16 p.m. UTC | #1
On 4/3/21 4:54 PM, Roman Bolshakov wrote:
> target_sequencer_start event is triggered inside target_cmd_init_cdb().
> se_cmd.tag is not initialized with ITT at the moment so the event always
> prints zero tag.
> 
> Cc: stable@vger.kernel.org # 5.10+
> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
> ---
>  drivers/target/iscsi/iscsi_target.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
> index d0e7ed8f28cc..e5c443bfbdf9 100644
> --- a/drivers/target/iscsi/iscsi_target.c
> +++ b/drivers/target/iscsi/iscsi_target.c
> @@ -1166,6 +1166,7 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
>  
>  	target_get_sess_cmd(&cmd->se_cmd, true);
>  
> +	cmd->se_cmd.tag = (__force u32)cmd->init_task_tag;
>  	cmd->sense_reason = target_cmd_init_cdb(&cmd->se_cmd, hdr->cdb);
>  	if (cmd->sense_reason) {
>  		if (cmd->sense_reason == TCM_OUT_OF_RESOURCES) {
> @@ -1180,8 +1181,6 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
>  	if (cmd->sense_reason)
>  		goto attach_cmd;
>  
> -	/* only used for printks or comparing with ->ref_task_tag */
> -	cmd->se_cmd.tag = (__force u32)cmd->init_task_tag;
>  	cmd->sense_reason = target_cmd_parse_cdb(&cmd->se_cmd);
>  	if (cmd->sense_reason)
>  		goto attach_cmd;
> 

Reviewed-by: Mike Christie <michael.christie@oracle.com>
Martin K. Petersen April 6, 2021, 4:52 a.m. UTC | #2
On Sun, 4 Apr 2021 00:54:15 +0300, Roman Bolshakov wrote:

> target_sequencer_start event is triggered inside target_cmd_init_cdb().
> se_cmd.tag is not initialized with ITT at the moment so the event always
> prints zero tag.

Applied to 5.12/scsi-fixes, thanks!

[1/1] target: iscsi: Fix zero tag inside a trace event
      https://git.kernel.org/mkp/scsi/c/0352c3d3959a
diff mbox series

Patch

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index d0e7ed8f28cc..e5c443bfbdf9 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -1166,6 +1166,7 @@  int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
 
 	target_get_sess_cmd(&cmd->se_cmd, true);
 
+	cmd->se_cmd.tag = (__force u32)cmd->init_task_tag;
 	cmd->sense_reason = target_cmd_init_cdb(&cmd->se_cmd, hdr->cdb);
 	if (cmd->sense_reason) {
 		if (cmd->sense_reason == TCM_OUT_OF_RESOURCES) {
@@ -1180,8 +1181,6 @@  int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
 	if (cmd->sense_reason)
 		goto attach_cmd;
 
-	/* only used for printks or comparing with ->ref_task_tag */
-	cmd->se_cmd.tag = (__force u32)cmd->init_task_tag;
 	cmd->sense_reason = target_cmd_parse_cdb(&cmd->se_cmd);
 	if (cmd->sense_reason)
 		goto attach_cmd;