[PATCH BUG FIX 2/2] nvme-multipath: clear BIO_QOS flags on requeue

Christoph Hellwig hch at lst.de
Sun Nov 23 23:01:42 PST 2025


On Mon, Nov 24, 2025 at 06:45:58AM +0000, Chaitanya Kulkarni wrote:
> >> Fix this by clearing both BIO_QOS_THROTTLED and BIO_QOS_MERGED flags
> >> when bios are redirected to the multipath head in nvme_failover_req().
> >> This is consistent with the existing code that clears REQ_POLLED and
> >> REQ_NOWAIT flags when the bio changes queues.
> >>
> >> Signed-off-by: Chaitanya Kulkarni <ckulkarnilinux at gmail.com>
> >> ---
> >>   drivers/nvme/host/multipath.c | 10 ++++++++++
> >>   1 file changed, 10 insertions(+)
> >>
> >> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
> >> index 3da980dc60d9..2535dba8ce1e 100644
> >> --- a/drivers/nvme/host/multipath.c
> >> +++ b/drivers/nvme/host/multipath.c
> >> @@ -168,6 +168,16 @@ void nvme_failover_req(struct request *req)
> >>   		 * the flag to avoid spurious EAGAIN I/O failures.
> >>   		 */
> >>   		bio->bi_opf &= ~REQ_NOWAIT;
> >> +		/*
> >> +		 * BIO_QOS_THROTTLED and BIO_QOS_MERGED were set when the bio
> >> +		 * went through the path's request queue rq_qos infrastructure.
> >> +		 * The bio is now being redirected to the multipath head's
> >> +		 * queue which may not have rq_qos enabled, so these flags are
> >> +		 * no longer valid and must be cleared to prevent
> >> +		 * rq_qos_done_bio() from dereferencing a NULL q->rq_qos.
> >> +		 */
> >> +		bio_clear_flag(bio, BIO_QOS_THROTTLED);
> >> +		bio_clear_flag(bio, BIO_QOS_MERGED);
> > This really should go into blk_steal_bios instead.  As should be the
> > existing nowait/polled fixups..
> >
> >
> even better, should I send a prep patch to move existing nowait/polled
> and second patch for QOS THROTTLED and MERGED that fixes the bug ?

Yes, we can probably move all of them including your new clear
in a separate patch (and wait until the next merge window).



More information about the Linux-nvme mailing list