2022-03-22 12:10:55

by John Garry

[permalink] [raw]
Subject: [PATCH 02/11] scsi: core: Add SUBMITTED_BY_SCSI_CUSTOM_OPS

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 <[email protected]>
---
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


2022-03-22 17:34:37

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 02/11] scsi: core: Add SUBMITTED_BY_SCSI_CUSTOM_OPS

On Tue, Mar 22, 2022 at 06:39:36PM +0800, John Garry wrote:
> 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().

CUSTOM_OPS sounds weird. I think the naming should match the naming
of whatever is used to submit it (haven't read the remaining patches
yet). And this should probably be folded into the patch that actually
uses it.