diff mbox series

[18/18] scsi: target: Move tag pr_debug to before we do a put on the cmd

Message ID 20230309223312.94595-19-michael.christie@oracle.com (mailing list archive)
State Superseded
Headers show
Series target: TMF and recovery fixes | expand

Commit Message

Mike Christie March 9, 2023, 10:33 p.m. UTC
We have to print the tag before we do the put, because the put could
free the cmd.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/target/target_core_transport.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index c260cb60f5cb..a39ffb8133f2 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -2970,11 +2970,12 @@  int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks)
 		if (cmd->se_lun)
 			transport_lun_remove_cmd(cmd);
 	}
-	if (aborted)
+	if (aborted) {
+		pr_debug("Detected CMD_T_ABORTED for ITT: %llu\n", cmd->tag);
 		cmd->free_compl = &compl;
+	}
 	ret = target_put_sess_cmd(cmd);
 	if (aborted) {
-		pr_debug("Detected CMD_T_ABORTED for ITT: %llu\n", cmd->tag);
 		wait_for_completion(&compl);
 		ret = 1;
 	}