[PATCH RFC 3/5] block: validate bio bounds in the queue entered context
Sagi Grimberg
sagi at grimberg.me
Sun Aug 23 02:22:47 PDT 2026
On 11/08/2026 0:23, Keith Busch wrote:
> On Mon, Aug 10, 2026 at 05:12:45PM -0400, Chris S wrote:
>> Keith, I checked this patch against the nvme_setup_rw() WARN I reported
>> (the second link in your cover letter). __bio_split_to_limits() is
>> called from blk_mq_submit_bio() after bio_queue_enter(), on both the
>> cached-request path and the newly-allocated-request path, so the bounds
>> check is now serialized against the freeze window in
>> nvme_update_ns_info_block(). With the capacity forced to 0, the bio is
>> failed here and can no longer reach nvme_queue_rq(), which is exactly
>> the race I hit. Thanks for picking it up, and sorry for the slow reply.
>>
>> I'll drop my own "nvme: don't WARN on I/O to a namespace revalidated to
>> unusable metadata" patch in favour of this.
> I'll need to revisit this approach as it is dependent on something in
> the stack calling the split to limits functions, as well as the upper
> layers error handling for a catching the end-of-device condition later
> than before.
>
Perhaps moving it into __bio_queue_enter would be appropriate... It already
does disk state check. Perhaps introduce bio_post_enter_checks() for checks
that need to serialize against queue enter?
More information about the Linux-nvme
mailing list