From: Jens Axboe <axboe@kernel.dk>
To: Cyril Brulebois <kibi@debian.org>, daan@amutable.com
Cc: Christian Brauner <brauner@kernel.org>,
Josef Bacik <josef@toxicpanda.com>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
nbd@other.debian.org, Christoph Hellwig <hch@infradead.org>,
Bart Van Assche <bvanassche@acm.org>,
Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
stable@vger.kernel.org
Subject: Re: [PATCH v2 0/2] loop, nbd: drop partitions left behind by the GD_NEED_PART_SCAN removal
Date: Mon, 19 Oct 2026 19:23:12 -0600 [thread overview]
Message-ID: <3ede4588-ffac-42ec-8058-b37c241b6830@kernel.dk> (raw)
In-Reply-To: <20261019233109.55q3cd266dfmkpa2@mraw.org>
On 10/19/26 5:31 PM, Cyril Brulebois wrote:
> Hi,
>
> Daan De Meyer via B4 Relay <devnull+daan.amutable.com@kernel.org> (2026-08-24):
>> Commit 267ec4d7223a ("loop: fix partition scan race between udev and
>> loop_reread_partitions()") stopped disk_force_media_change() from setting
>> GD_NEED_PART_SCAN. The caller audit in that commit only considered the bit
>> as a request to rescan partitions, but it did more than that:
>> bdev_disk_changed() drops every entry in disk->part_tbl before it consults
>> disk_has_partscan(), and only the re-adding half is gated on partition
>> scanning being enabled. The lazy scan on the next open was therefore also
>> the only thing removing partitions from a device that has partitions but
>> no partition scanning.
>>
>> Loop devices without LO_FLAGS_PARTSCAN are exactly such devices, and they
>> are not unusual. bdev_add_partition() only rejects GENHD_FL_NO_PART disks,
>> so BLKPG_ADD_PARTITION works while GD_SUPPRESS_PART_SCAN is set, and
>> parted, libfdisk and systemd all fall back to BLKPG when BLKRRPART fails
>> with -EINVAL, which is what a loop device without LO_FLAGS_PARTSCAN
>> returns.
>>
>> Commit c4f4c0fc551c ("loop: remove manually added partitions on detach")
>> fixed the detach path after this was reported as loop devices picking up
>> partition devices from a previously built image:
>>
>> https://bugs.debian.org/1141434
>>
>> These two patches fix the two remaining places that relied on the same
>> lazy cleanup, LOOP_CHANGE_FD and NBD_CLEAR_SOCK.
>>
>> Regression tests for both paths have been submitted to blktests:
>>
>> https://github.com/linux-blktests/blktests/pull/259
>> https://github.com/linux-blktests/blktests/pull/260
>>
>> Signed-off-by: Daan De Meyer <daan@amutable.com>
>> ---
>> Changes in v2:
>> - Rewrap the comments added by both patches so they fit in 80 columns
>> (Christoph Hellwig).
>> - No functional change, so the review and test tags from v1 were carried
>> over.
>> - Link to v1: https://patch.msgid.link/20260806-b4-loop-nbd-stale-partitions-v1-0-67bb75a8d7be@amutable.com
>
> It would be nice if those fixes could get picked up eventually. They
> received a few Reviewed-by and Tested-by already, and that v2 is only
> about line wrapping anyway.
They need a respin.
--
Jens Axboe
prev parent reply other threads:[~2026-10-20 1:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 13:32 [PATCH v2 0/2] loop, nbd: drop partitions left behind by the GD_NEED_PART_SCAN removal Daan De Meyer via B4 Relay
2026-08-24 13:32 ` [PATCH v2 1/2] loop: drop stale partitions on LOOP_CHANGE_FD Daan De Meyer via B4 Relay
2026-08-25 5:45 ` Christoph Hellwig
2026-08-24 13:32 ` [PATCH v2 2/2] nbd: drop stale partitions on NBD_CLEAR_SOCK Daan De Meyer via B4 Relay
2026-08-25 5:45 ` Christoph Hellwig
2026-10-19 23:31 ` [PATCH v2 0/2] loop, nbd: drop partitions left behind by the GD_NEED_PART_SCAN removal Cyril Brulebois
2026-10-20 1:23 ` Jens Axboe [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=3ede4588-ffac-42ec-8058-b37c241b6830@kernel.dk \
--to=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=bvanassche@acm.org \
--cc=daan@amutable.com \
--cc=hch@infradead.org \
--cc=josef@toxicpanda.com \
--cc=kibi@debian.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nbd@other.debian.org \
--cc=shinichiro.kawasaki@wdc.com \
--cc=stable@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