summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2022-08-23 13:38:19 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-09-15 11:47:15 +0300
commit4c9a8adb14d2a6b2f005db6b1cc68bd4492ed0e6 (patch)
tree5bfd36154e161f1ddd3ade5b346d93d513924e2d /block
parent26a6d7d42972649277541483f794ec0f12b4e00c (diff)
downloadlinux-4c9a8adb14d2a6b2f005db6b1cc68bd4492ed0e6.tar.xz
block: don't add partitions if GD_SUPPRESS_PART_SCAN is set
[ Upstream commit 748008e1da926a814cc0a054c81ca614408b1b0c ] Commit b9684a71fca7 ("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: b9684a71fca7 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'block')
-rw-r--r--block/partitions/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/block/partitions/core.c b/block/partitions/core.c
index 8a0ec929023b..76617b1d2d47 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -597,6 +597,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;