Linux block layer
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Ming Lei <tom.leiming@gmail.com>
Cc: Keith Busch <kbusch@meta.com>,
	axboe@kernel.dk, hch@lst.de, linux-block@vger.kernel.org
Subject: Re: [PATCHv2] blk-mq: check for stale cached request in blk_mq_submit_bio
Date: Mon, 18 May 2026 21:07:22 -0600	[thread overview]
Message-ID: <agvT6mMM5Tc2ABbk@kbusch-mbp> (raw)
In-Reply-To: <agu74lMg10kxPXrl@fedora>

On Tue, May 19, 2026 at 09:24:50AM +0800, Ming Lei wrote:
> On Fri, May 01, 2026 at 10:41:19AM -0700, Keith Busch wrote:
> >  
> >  new_request:
> >  	if (rq) {
> > -		blk_mq_use_cached_rq(rq, plug, bio);
> > +		if (!blk_mq_use_cached_rq(rq, plug, bio)) {
> > +			struct bio_integrity_payload *bip = bio_integrity(bio);
> > +
> > +			if (bip && (bip->bip_flags & BIP_BLOCK_INTEGRITY))
> > +				bio_integrity_free(bio);
> > +			rq = NULL;
> > +			goto retry;
> > +		}
> 
> This way still looks fragile, given rq isn't guaranteed to be live.

Yeah. The current usage in this patch looks like it should work out, but
not necessarily by design, so yes, fragile.
 
> Just wondering why not pop it from plug->cached_rqs from beginning, and
> move it back in case of `queue_exit:`?

Not sure. I guess it's an optimization when the bio merges with a
previous request in the plug? If we popped initially, a successful merge
has to push it back. Maybe there's a better reason I'm not seeing.

  reply	other threads:[~2026-05-19  3:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01 17:41 [PATCHv2] blk-mq: check for stale cached request in blk_mq_submit_bio Keith Busch
2026-05-18 14:44 ` Keith Busch
2026-05-19  6:47   ` Christoph Hellwig
2026-05-19  1:24 ` Ming Lei
2026-05-19  3:07   ` Keith Busch [this message]
2026-05-19  3:36     ` Ming Lei

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=agvT6mMM5Tc2ABbk@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=kbusch@meta.com \
    --cc=linux-block@vger.kernel.org \
    --cc=tom.leiming@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox