From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
linux-block@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-scsi@vger.kernel.org
Subject: [PATCH 12/14] block: don't set GENHD_FL_NO_PART for hidden gendisks
Date: Mon, 22 Nov 2021 14:06:23 +0100 [thread overview]
Message-ID: <20211122130625.1136848-13-hch@lst.de> (raw)
In-Reply-To: <20211122130625.1136848-1-hch@lst.de>
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>
---
block/genhd.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/block/genhd.c b/block/genhd.c
index e9346fae48ad4..b1c194813e22f 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)
--
2.30.2
next prev parent reply other threads:[~2021-11-22 13:06 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-22 13:06 cleanup and simplify the gendisk flags Christoph Hellwig
2021-11-22 13:06 ` [PATCH 01/14] block: move GENHD_FL_NATIVE_CAPACITY to disk->state Christoph Hellwig
2021-11-22 13:06 ` [PATCH 02/14] block: move GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE to disk->event_flags Christoph Hellwig
2021-11-22 13:06 ` [PATCH 03/14] block: remove GENHD_FL_CD Christoph Hellwig
2021-11-22 13:06 ` [PATCH 04/14] block: remove a dead check in show_partition Christoph Hellwig
2021-11-22 13:06 ` [PATCH 05/14] block: merge disk_scan_partitions and blkdev_reread_part Christoph Hellwig
2021-11-22 13:06 ` [PATCH 06/14] block: rename GENHD_FL_NO_PART_SCAN to GENHD_FL_NO_PART Christoph Hellwig
2021-11-22 14:02 ` Ulf Hansson
2021-11-22 13:06 ` [PATCH 07/14] block: remove the GENHD_FL_HIDDEN check in blkdev_get_no_open Christoph Hellwig
2021-11-22 13:06 ` [PATCH 08/14] null_blk: don't suppress partitioning information Christoph Hellwig
2021-11-22 13:06 ` [PATCH 09/14] mmc: don't set GENHD_FL_SUPPRESS_PARTITION_INFO Christoph Hellwig
2021-11-22 14:02 ` Ulf Hansson
2021-11-22 13:06 ` [PATCH 10/14] block: remove GENHD_FL_SUPPRESS_PARTITION_INFO Christoph Hellwig
2021-11-22 13:06 ` [PATCH 11/14] block: remove GENHD_FL_EXT_DEVT Christoph Hellwig
2022-05-25 14:35 ` Ming Lei
2022-05-25 16:51 ` Christoph Hellwig
2022-05-25 16:51 ` Christoph Hellwig
2022-05-26 3:06 ` Ming Lei
2022-05-26 9:08 ` Christoph Hellwig
2021-11-22 13:06 ` Christoph Hellwig [this message]
2021-11-22 13:06 ` [PATCH 13/14] block: cleanup the GENHD_FL_* definitions Christoph Hellwig
2021-11-22 13:06 ` [PATCH 14/14] sr: set GENHD_FL_REMOVABLE earlier Christoph Hellwig
2021-11-23 16:10 ` cleanup and simplify the gendisk flags Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211122130625.1136848-13-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox