From: John Garry <john.garry@linux.dev>
To: Bart Van Assche <bvanassche@acm.org>,
james.bottomley@hansenpartnership.com, mkp@kernel.org
Cc: hare@suse.com, linux-nvme@lists.infradead.org,
linux-scsi@vger.kernel.org, snitzer@kernel.org,
jmeneghi@redhat.com, bmarzins@redhat.com,
dm-devel@lists.linux.dev, hch@lst.de,
michael.christie@oracle.com
Subject: Re: [PATCH v9 01/29] scsi: core: Clear cmd->flags for terminal queuing error
Date: Sun, 15 Nov 2026 18:37:28 +0000 [thread overview]
Message-ID: <84b50119-cb4a-4bda-9ab8-7b590216858e@linux.dev> (raw)
In-Reply-To: <060d5e0d-764e-40bd-8bb7-ead8d4ada5b0@acm.org>
On 11/9/26 20:49, Bart Van Assche wrote:
> On 11/8/26 12:47 PM, John Garry wrote:
> > If a request can't be queued in scsi_queue_rq(), then we error out
> > with a blk_status_t code. Such a scenario may be the scsi_device has
> > its transport offline. For BLK_STS_RESOURCE or BLK_STS_AGAIN, the
> > request will be requeued in the block layer.
>
> This is not correct for BLK_STS_AGAIN. Only BLK_STS_RESOURCE and
> BLK_STS_DEV_RESOURCE cause the block layer to requeue a request. For
> all other status codes, including BLK_STS_AGAIN,
> blk_mq_dispatch_rq_list() and blk_mq_try_issue_directly() call
> blk_mq_end_request().
ok, right
>
> > For other errors, the block layer ends the request and so we won't
> > see it again (until recycled). Normally when a request completes
> > scmd->flags is cleared in scsi_end_request(). However for the error
> > scenario mentioned above, scsi_end_request() is not called and so
> > scmd->flags is not cleared. As such, when the request is recycled we
> > see the old value in scmd->flags.
>
> Please describe the consequences of this bug in the patch description.
> As far as I can tell there are at least two:
> - SCMD_FAIL_IF_RECOVERING is part of SCMD_PRESERVED_FLAGS and
> scsi_execute_cmd() ORs new flags into scmd->flags. If a command
> submitted with SCMD_FAIL_IF_RECOVERING is failed with BLK_STS_OFFLINE
> because the host is in recovery, the flag leaks into the next request
> that is allocated with the same tag. That request will then be failed
> instead of requeued if it is submitted while the SCSI error handler
> is active.
> - If SCMD_INITIALIZED leaks, scsi_init_command() skips
> scsi_initialize_rq() for the next filesystem request. Hence,
> jiffies_at_alloc and retries are not reinitialized and that request
> may be failed prematurely by scsi_cmd_runtime_exceeded().
> > > Fix this issue by clearing scmd->flags in the error scenario
mentioned
> > by calling scsi_cleanup_rq().
>
> Please add Fixes: and Cc: stable tags. For the SCMD_FAIL_IF_RECOVERING
> leak, I think this should be:
>
> Fixes: 310bcaef6d7e ("scsi: core: Support failing requests while
> recovering")
I am more inclined to go back to some commit pre-LTS v5.15, which is the
oldest LTS maintained today. Even if you check 64104f703212f, I'd say
that the issue existed then.
>
> > @@ -1994,8 +1994,8 @@ static blk_status_t scsi_queue_rq(struct
> blk_mq_hw_ctx *hctx,
> > * we hit an error, as we will never see this command
> > * again.
> > */
> > - if (req->rq_flags & RQF_DONTPREP)
> > - scsi_mq_uninit_cmd(cmd);
> > + scsi_cleanup_rq(req);
> > + scsi_run_queue_async(sdev);
>
> Since the block layer also ends requests for which scsi_queue_rq()
> returns BLK_STS_AGAIN, the BLK_STS_AGAIN case has the same issue.
> Please convert that case too:
>
> case BLK_STS_AGAIN:
> cmd->result = DID_BUS_BUSY << 16;
> scsi_cleanup_rq(req);
> break;
>
ok, fine. BTW, does anyone ever check cmd->result in this case, or are
we just exercising good practice to set the result to failed?
> Although no SCSI driver returns BLK_STS_AGAIN today, I think both
> error paths should handle this in the same way.
>
Hi Martin, I would really rather not post yet another version of this
series. How about send the extra change which Bart requested separately?
Thanks,
John
next prev parent reply other threads:[~2026-11-15 18:37 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 20:47 [PATCH v9 00/29] Native SCSI Multipath support John Garry
2026-11-08 20:47 ` [PATCH v9 01/29] scsi: core: Clear cmd->flags for terminal queuing error John Garry
2026-11-09 20:49 ` Bart Van Assche
2026-11-15 18:37 ` John Garry [this message]
2026-11-15 20:42 ` Bart Van Assche
2026-11-08 20:47 ` [PATCH v9 02/29] libmultipath: Add initial framework John Garry
2026-11-08 20:47 ` [PATCH v9 03/29] libmultipath: Add basic gendisk support John Garry
2026-11-08 20:47 ` [PATCH v9 04/29] libmultipath: Add path selection support John Garry
2026-11-08 21:07 ` sashiko-bot
2026-11-08 20:47 ` [PATCH v9 05/29] libmultipath: Add bio handling John Garry
2026-11-08 20:47 ` [PATCH v9 06/29] libmultipath: Add support for mpath_device management John Garry
2026-11-08 20:47 ` [PATCH v9 07/29] libmultipath: Add delayed removal support John Garry
2026-11-08 21:11 ` sashiko-bot
2026-11-08 20:47 ` [PATCH v9 08/29] libmultipath: Add sysfs helpers John Garry
2026-11-08 21:02 ` sashiko-bot
2026-11-08 20:47 ` [PATCH v9 09/29] libmultipath: Add support for block device IOCTL John Garry
2026-11-08 21:09 ` sashiko-bot
2026-11-08 20:47 ` [PATCH v9 10/29] libmultipath: Add mpath_bdev_getgeo() John Garry
2026-11-08 20:47 ` [PATCH v9 11/29] libmultipath: Add mpath_bdev_get_unique_id() John Garry
2026-11-08 20:47 ` [PATCH v9 12/29] scsi-multipath: introduce basic SCSI device support John Garry
2026-11-08 21:02 ` sashiko-bot
2026-11-08 20:47 ` [PATCH v9 13/29] scsi-multipath: introduce scsi_device head structure John Garry
2026-11-08 20:47 ` [PATCH v9 14/29] scsi-multipath: provide sysfs link from to scsi_device John Garry
2026-11-08 20:47 ` [PATCH v9 15/29] scsi-multipath: support iopolicy John Garry
2026-11-08 20:47 ` [PATCH v9 16/29] scsi-multipath: clone each bio John Garry
2026-11-08 20:47 ` [PATCH v9 17/29] scsi-multipath: clear path when device is blocked John Garry
2026-11-08 21:06 ` sashiko-bot
2026-11-08 20:47 ` [PATCH v9 18/29] scsi-multipath: revalidate paths upon device unblock John Garry
2026-11-08 21:08 ` sashiko-bot
2026-11-08 20:47 ` [PATCH v9 19/29] scsi-multipath: failover handling John Garry
2026-11-08 21:15 ` sashiko-bot
2026-11-08 20:47 ` [PATCH v9 20/29] scsi-multipath: provide callbacks for path state John Garry
2026-11-08 21:05 ` sashiko-bot
2026-11-08 20:47 ` [PATCH v9 21/29] scsi-multipath: add scsi_mpath_{start,end}_request() John Garry
2026-11-08 21:28 ` sashiko-bot
2026-11-08 20:47 ` [PATCH v9 22/29] scsi-multipath: update request for terminal request queuing error John Garry
2026-11-08 21:09 ` sashiko-bot
2026-11-08 20:47 ` [PATCH v9 23/29] scsi-multipath: add delayed disk removal support John Garry
2026-11-08 20:47 ` [PATCH v9 24/29] scsi: sd: add multipath disk class John Garry
2026-11-08 20:47 ` [PATCH v9 25/29] scsi: sd: add multipath disk attr groups John Garry
2026-11-08 20:47 ` [PATCH v9 26/29] scsi: sd: support multipath disk John Garry
2026-11-08 21:23 ` sashiko-bot
2026-11-08 20:47 ` [PATCH v9 27/29] scsi: sd: add mpath_dev file John Garry
2026-11-08 20:47 ` [PATCH v9 28/29] scsi: sd: add mpath_numa_nodes dev attribute John Garry
2026-11-08 20:47 ` [PATCH v9 29/29] scsi: sd: add mpath_queue_depth " John Garry
2026-11-09 20:19 ` [PATCH v9 00/29] Native SCSI Multipath support Laurence Oberman
2026-11-10 9:05 ` John Garry
2026-11-14 13:03 ` Xose Vazquez Perez
2026-11-14 16:29 ` Laurence Oberman
2026-11-14 19:59 ` Laurence Oberman
2026-11-15 17:43 ` John Garry
2026-11-15 18:59 ` John Garry
2026-11-15 19:50 ` Laurence Oberman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84b50119-cb4a-4bda-9ab8-7b590216858e@linux.dev \
--to=john.garry@linux.dev \
--cc=bmarzins@redhat.com \
--cc=bvanassche@acm.org \
--cc=dm-devel@lists.linux.dev \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=jmeneghi@redhat.com \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=michael.christie@oracle.com \
--cc=mkp@kernel.org \
--cc=snitzer@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.