Skip to content

Commit

Permalink
block: don't add partitions if GD_SUPPRESS_PART_SCAN is set
Browse files Browse the repository at this point in the history
Commit b9684a7 ("block, loop: support partitions without scanning")
adds GD_SUPPRESS_PART_SCAN for replacing part function of
GENHD_FL_NO_PART. But looks blk_add_partitions() is missed, since
loop doesn't want to add partitions if GENHD_FL_NO_PART was set.
And it causes regression on libblockdev (as called from udisks) which
operates with the LO_FLAGS_PARTSCAN.

Fixes the issue by not adding partitions if GD_SUPPRESS_PART_SCAN is
set.

Fixes: b9684a7 ("block, loop: support partitions without scanning")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220823103819.395776-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Ming Lei authored and axboe committed Sep 3, 2022
1 parent 7a3d222 commit 748008e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions block/partitions/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ static int blk_add_partitions(struct gendisk *disk)
if (disk->flags & GENHD_FL_NO_PART)
return 0;

if (test_bit(GD_SUPPRESS_PART_SCAN, &disk->state))
return 0;

state = check_partition(disk);
if (!state)
return 0;
Expand Down

0 comments on commit 748008e

Please sign in to comment.