Re: [PATCH] loop: remove manually added partitions on detach
From: Jens Axboe
Date: Wed Jul 15 2026 - 18:34:46 EST
On Wed, 15 Jul 2026 21:39:57 +0200, Daan De Meyer wrote:
> Commit 267ec4d7223a ("loop: fix partition scan race between udev and
> loop_reread_partitions()") stopped disk_force_media_change() from
> setting GD_NEED_PART_SCAN because loop devices with LO_FLAGS_PARTSCAN
> rescan partitions explicitly. However, partitions can also be added
> manually with BLKPG while LO_FLAGS_PARTSCAN is clear.
>
> When such a loop device is detached, __loop_clr_fd() skips
> bdev_disk_changed(). Without GD_NEED_PART_SCAN, reopening the unbound
> device no longer performs the previous lazy cleanup, leaving dead
> partition devices behind. A subsequent LOOP_CONFIGURE can then fail its
> partition scan with -EBUSY, as seen in blktests loop/009 after loop/008.
>
> [...]
Applied, thanks!
[1/1] loop: remove manually added partitions on detach
commit: c4f4c0fc551cbcdccbbbc2d874d7d6440c7b4983
Best regards,
--
Jens Axboe