Skip to content

block: remove redundant GD_NEED_PART_SCAN in add_disk_final()#966

Open
blktests-ci[bot] wants to merge 2 commits into
linus-master_basefrom
series/1111700=>linus-master
Open

block: remove redundant GD_NEED_PART_SCAN in add_disk_final()#966
blktests-ci[bot] wants to merge 2 commits into
linus-master_basefrom
series/1111700=>linus-master

Conversation

@blktests-ci

@blktests-ci blktests-ci Bot commented Jun 15, 2026

Copy link
Copy Markdown

Pull request for series with
subject: block: remove redundant GD_NEED_PART_SCAN in add_disk_final()
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1111700

@blktests-ci

blktests-ci Bot commented Jun 15, 2026

Copy link
Copy Markdown
Author

Upstream branch: 062871f
series: https://patchwork.kernel.org/project/linux-block/list/?series=1111700
version: 1

@blktests-ci

blktests-ci Bot commented Jun 17, 2026

Copy link
Copy Markdown
Author

Upstream branch: 5b33fc6
series: https://patchwork.kernel.org/project/linux-block/list/?series=1111700
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1111700=>linus-master branch from faecb57 to 6e7b4cd Compare June 17, 2026 11:59
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 199644a to e6d9eb8 Compare June 17, 2026 12:02
@blktests-ci

blktests-ci Bot commented Jun 17, 2026

Copy link
Copy Markdown
Author

Upstream branch: 66affa3
series: https://patchwork.kernel.org/project/linux-block/list/?series=1111700
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1111700=>linus-master branch from 6e7b4cd to 06c106c Compare June 17, 2026 12:15
@blktests-ci

blktests-ci Bot commented Jun 18, 2026

Copy link
Copy Markdown
Author

Upstream branch: 66affa3
series: https://patchwork.kernel.org/project/linux-block/list/?series=1111700
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1111700=>linus-master branch from 06c106c to 88b4f03 Compare June 18, 2026 14:25
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from e6d9eb8 to 7d8604f Compare June 24, 2026 01:11
@blktests-ci

blktests-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown
Author

Upstream branch: bade58e
series: https://patchwork.kernel.org/project/linux-block/list/?series=1111700
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1111700=>linus-master branch from 88b4f03 to c9698f1 Compare June 24, 2026 01:32
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 7d8604f to 4cc45a3 Compare June 26, 2026 08:14
@blktests-ci

blktests-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown
Author

Upstream branch: 4edcdef
series: https://patchwork.kernel.org/project/linux-block/list/?series=1111700
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1111700=>linus-master branch from c9698f1 to 42b2434 Compare June 26, 2026 08:51
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 4cc45a3 to 90ffd56 Compare June 29, 2026 17:14
@blktests-ci

blktests-ci Bot commented Jun 29, 2026

Copy link
Copy Markdown
Author

Upstream branch: dc59e4f
series: https://patchwork.kernel.org/project/linux-block/list/?series=1111700
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1111700=>linus-master branch from 42b2434 to e64be54 Compare June 29, 2026 17:55
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 90ffd56 to d52f35a Compare July 2, 2026 19:18
@blktests-ci

blktests-ci Bot commented Jul 2, 2026

Copy link
Copy Markdown
Author

Upstream branch: 87320be
series: https://patchwork.kernel.org/project/linux-block/list/?series=1111700
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1111700=>linus-master branch from e64be54 to 24c0961 Compare July 2, 2026 19:53
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from d52f35a to a644c13 Compare July 6, 2026 08:28
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.

The race is observable by inserting an msleep() between bdev_add()
and disk_scan_partitions() while running concurrent open() calls
during device bind. Without artificial delay, it manifests under
scheduling pressure during boot on systems with aggressive device
scanners (multipathd, systemd-udevd).

Therefore, do not set GD_NEED_PART_SCAN in add_disk_final(). Other
GD_NEED_PART_SCAN consumers (blkdev_get_whole(),
sd_need_revalidate()) should not be affected as the flag
is set internally by disk_scan_partitions().

The retry-on-next-open intention from commit e5cfefa
("block: fix scan partition for exclusively open device again")
should also not be affected as the early return paths in
disk_scan_partitions() should be unreachable at device registration
time (bd_holder is NULL and open_partitions is zero).

Fixes: e5cfefa ("block: fix scan partition for exclusively open device again")
Cc: stable@vger.kernel.org
Signed-off-by: Connor Williamson <connordw@amazon.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
@blktests-ci

blktests-ci Bot commented Jul 6, 2026

Copy link
Copy Markdown
Author

Upstream branch: 8cdeaa5
series: https://patchwork.kernel.org/project/linux-block/list/?series=1111700
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1111700=>linus-master branch from 24c0961 to f660739 Compare July 6, 2026 09:31
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from a644c13 to a2204c3 Compare July 7, 2026 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant