[PATCH 02/11] scsi: core: Add SUBMITTED_BY_SCSI_CUSTOM_OPS

From: John Garry
Date: Tue Mar 22 2022 - 06:46:00 EST


Add a new type of submitter, SUBMITTED_BY_SCSI_CUSTOM_OPS, for when a
SCSI cmnd is submitted via the block layer but not by scsi_queue_rq().

Since this is not a true SCSI cmnd we should do nothing for it in
scsi_done_internal().

Signed-off-by: John Garry <john.garry@xxxxxxxxxx>
---
drivers/scsi/scsi_lib.c | 2 ++
include/scsi/scsi_cmnd.h | 1 +
2 files changed, 3 insertions(+)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index a7788184908e..d230392f2b4a 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1615,6 +1615,8 @@ static void scsi_done_internal(struct scsi_cmnd *cmd, bool complete_directly)
return scsi_eh_done(cmd);
case SUBMITTED_BY_SCSI_RESET_IOCTL:
return;
+ case SUBMITTED_BY_SCSI_CUSTOM_OPS:
+ return;
}

if (unlikely(blk_should_fake_timeout(scsi_cmd_to_rq(cmd)->q)))
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 76c5eaeeb3b5..ad4bcace1390 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -64,6 +64,7 @@ enum scsi_cmnd_submitter {
SUBMITTED_BY_BLOCK_LAYER = 0,
SUBMITTED_BY_SCSI_ERROR_HANDLER = 1,
SUBMITTED_BY_SCSI_RESET_IOCTL = 2,
+ SUBMITTED_BY_SCSI_CUSTOM_OPS = 3,
} __packed;

struct scsi_cmnd {
--
2.26.2