summaryrefslogtreecommitdiffstats
path: root/block/genhd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-11-22 14:06:23 +0100
committerJens Axboe <axboe@kernel.dk>2021-11-29 14:38:35 +0100
commit9f18db572c97bc327b63528d195fdb252f47e9de (patch)
tree935bd15a1154bdab12058fbe4424b563e08b359e /block/genhd.c
parentblock: remove GENHD_FL_EXT_DEVT (diff)
downloadlinux-9f18db572c97bc327b63528d195fdb252f47e9de.tar.xz
linux-9f18db572c97bc327b63528d195fdb252f47e9de.zip
block: don't set GENHD_FL_NO_PART for hidden gendisks
Hidden gendisks can't be opened using blkdev_get_*, so we can't really reach any of the partition scanning paths or partitioning ioctls except for the initial partition scan from add_disk. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20211122130625.1136848-13-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 628632537129..8e9cbf23c510 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -376,7 +376,7 @@ int disk_scan_partitions(struct gendisk *disk, fmode_t mode)
{
struct block_device *bdev;
- if (disk->flags & GENHD_FL_NO_PART)
+ if (disk->flags & (GENHD_FL_NO_PART | GENHD_FL_HIDDEN))
return -EINVAL;
if (disk->open_partitions)
return -EBUSY;
@@ -493,12 +493,7 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
if (ret)
goto out_put_slave_dir;
- if (disk->flags & GENHD_FL_HIDDEN) {
- /*
- * Don't bother scanning for partitions.
- */
- disk->flags |= GENHD_FL_NO_PART;
- } else {
+ if (!(disk->flags & GENHD_FL_HIDDEN)) {
ret = bdi_register(disk->bdi, "%u:%u",
disk->major, disk->first_minor);
if (ret)