From: Christoph Hellwig <hch@infradead.org>
To: Daan De Meyer <daan.j.demeyer@gmail.com>
Cc: linux-block@vger.kernel.org, axboe@kernel.dk, brauner@kernel.org,
Daan De Meyer <daan@amutable.com>
Subject: Re: [PATCH v2] loop: fix partition scan race between udev and loop_reread_partitions()
Date: Tue, 31 Mar 2026 00:23:43 -0700 [thread overview]
Message-ID: <act2f6C86rIHuwsC@infradead.org> (raw)
In-Reply-To: <20260330110310.692144-1-daan@amutable.com>
On Mon, Mar 30, 2026 at 11:03:10AM +0000, Daan De Meyer wrote:
> Fix this by clearing GD_NEED_PART_SCAN before sending the uevent when
> LO_FLAGS_PARTSCAN is set. Since loop_reread_partitions() will perform
> the authoritative partition scan, the lazy on-open scan triggered by
> GD_NEED_PART_SCAN is redundant. With the flag cleared, udev opening
> the device no longer triggers a scan in blkdev_get_whole(), and only
> the single explicit scan from loop_reread_partitions() runs.
Setting the flag and instantly clearing them seems like a bad idea.
So add a variant that doesn't set it instead, or audit the callers
for who even needs the flag set. floppy doesn't because it doesn't
support partitions, and the other callers in loop also look
suspicious.
Also can you wire up a test for this in blktests?
prev parent reply other threads:[~2026-03-31 7:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 8:18 [PATCH] loop: fix partition scan race between udev and loop_reread_partitions() Daan De Meyer
2026-03-30 11:03 ` [PATCH v2] " Daan De Meyer
2026-03-31 7:23 ` Christoph Hellwig [this message]
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=act2f6C86rIHuwsC@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=daan.j.demeyer@gmail.com \
--cc=daan@amutable.com \
--cc=linux-block@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox