Re: [PATCH] block: remove redundant GD_NEED_PART_SCAN in add_disk_final()

From: Jens Axboe

Date: Fri Jul 10 2026 - 11:20:00 EST



On Mon, 15 Jun 2026 13:07:15 +0000, Connor Williamson wrote:
> add_disk_final() sets GD_NEED_PART_SCAN before calling bdev_add(),
> then calls disk_scan_partitions() which sets the flag itself. The
> early set is redundant and introduces a race.
>
> Between bdev_add() and disk_scan_partitions(), concurrent openers
> (multipathd, blkid, LVM) see the flag in blkdev_get_whole() and
> trigger bdev_disk_changed(). When disk_scan_partitions() then runs,
> it calls bdev_disk_changed() again, dropping the partitions the
> concurrent opener already created before re-adding them, which can
> result in transient partition disappearances.
>
> [...]

Applied, thanks!

[1/1] block: remove redundant GD_NEED_PART_SCAN in add_disk_final()
commit: 181bb9c9eae4f69fe510a62a42c2932d0314a800

Best regards,
--
Jens Axboe