From: Vincent Mailhol <mailhol@kernel.org>
To: Jens Axboe <axboe@kernel.dk>, Davidlohr Bueso <dave@stgolabs.net>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
linux-efi@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Vincent Mailhol <mailhol@kernel.org>
Subject: [PATCH 16/19] block: don't discover partition with DPS no-auto GPT attribute
Date: Mon, 15 Jun 2026 18:09:12 +0200 [thread overview]
Message-ID: <20260615-discoverable-root_partitions-v1-16-39c78fac42e2@kernel.org> (raw)
In-Reply-To: <20260615-discoverable-root_partitions-v1-0-39c78fac42e2@kernel.org>
DPS [1] defines GPT attribute bit 63 as no-auto. Partitions with this
bit set must not be used by automatic discovery.
Add the new GPT_ATTRIBUTE_NO_AUTO flag to designate the GPT attribute
bit 63.
Add the new ADDPART_FLAG_NO_AUTO flag and set it when
GPT_ATTRIBUTE_NO_AUTO is set during the partition scan. Then, propagate
it to the new BD_NO_AUTO_DISCOVERY flag.
Finally, add a condition to match_dev_by_type_uuid() to exclude any
partition with that flag from the automatic discovery.
[1] The Discoverable Partitions Specification (DPS)
Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/
Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
---
block/blk.h | 1 +
block/early-lookup.c | 1 +
block/partitions/core.c | 2 ++
block/partitions/efi.c | 2 ++
block/partitions/efi.h | 3 +++
include/linux/blk_types.h | 1 +
6 files changed, 10 insertions(+)
diff --git a/block/blk.h b/block/blk.h
index b998a7761faf..14e0f349ff14 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -604,6 +604,7 @@ void blk_free_ext_minor(unsigned int minor);
#define ADDPART_FLAG_RAID 1
#define ADDPART_FLAG_WHOLEDISK 2
#define ADDPART_FLAG_READONLY 4
+#define ADDPART_FLAG_NO_AUTO 8
int bdev_add_partition(struct gendisk *disk, int partno, sector_t start,
sector_t length);
int bdev_del_partition(struct gendisk *disk, int partno);
diff --git a/block/early-lookup.c b/block/early-lookup.c
index cd10785e70ac..8db0abec141e 100644
--- a/block/early-lookup.c
+++ b/block/early-lookup.c
@@ -266,6 +266,7 @@ static int __init match_dev_by_type_uuid(struct device *dev, const void *data)
const struct uuidcmp *cmp = data;
return bdev->bd_disk == cmp->disk && bdev->bd_meta_info &&
+ !bdev_test_flag(bdev, BD_NO_AUTO_DISCOVERY) &&
!strcasecmp(cmp->uuid, bdev->bd_meta_info->type_uuid);
}
diff --git a/block/partitions/core.c b/block/partitions/core.c
index 5d5332ce586b..4529ea1d308e 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -382,6 +382,8 @@ static struct block_device *add_partition(struct gendisk *disk, int partno,
if (flags & ADDPART_FLAG_READONLY)
bdev_set_flag(bdev, BD_READ_ONLY);
+ if (flags & ADDPART_FLAG_NO_AUTO)
+ bdev_set_flag(bdev, BD_NO_AUTO_DISCOVERY);
/* everything is up and running, commence */
err = xa_insert(&disk->part_tbl, partno, bdev, GFP_KERNEL);
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index 4a3835ed9561..50c21625e256 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -739,6 +739,8 @@ int efi_partition(struct parsed_partitions *state)
/* If this is a RAID volume, tell md */
if (!efi_guidcmp(ptes[i].partition_type_guid, PARTITION_LINUX_RAID_GUID))
state->parts[i + 1].flags = ADDPART_FLAG_RAID;
+ if (le64_to_cpu(ptes[i].attributes) & GPT_ATTRIBUTE_NO_AUTO)
+ state->parts[i + 1].flags |= ADDPART_FLAG_NO_AUTO;
info = &state->parts[i + 1].info;
efi_guid_to_str(&ptes[i].unique_partition_guid, info->uuid);
diff --git a/block/partitions/efi.h b/block/partitions/efi.h
index 1f56f93b2804..fb50edb66e84 100644
--- a/block/partitions/efi.h
+++ b/block/partitions/efi.h
@@ -11,6 +11,7 @@
#ifndef FS_PART_EFI_H_INCLUDED
#define FS_PART_EFI_H_INCLUDED
+#include <linux/bits.h>
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/kernel.h>
@@ -30,6 +31,8 @@
#define GPT_HEADER_REVISION_V1 0x00010000
#define GPT_PRIMARY_PARTITION_TABLE_LBA 1
+#define GPT_ATTRIBUTE_NO_AUTO BIT_U64(63)
+
#define PARTITION_SYSTEM_GUID \
EFI_GUID( 0xC12A7328, 0xF81F, 0x11d2, \
0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B)
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 8808ee76e73c..c6cdc99b0490 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -54,6 +54,7 @@ struct block_device {
#ifdef CONFIG_FAIL_MAKE_REQUEST
#define BD_MAKE_IT_FAIL (1u<<12)
#endif
+#define BD_NO_AUTO_DISCOVERY (1u<<13)
dev_t bd_dev;
struct address_space *bd_mapping; /* page cache */
--
2.53.0
next prev parent reply other threads:[~2026-06-15 16:11 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 16:08 [PATCH 00/19] init: discoverable root partitions, a.k.a. an omittable "root=" cmdline option Vincent Mailhol
2026-06-15 16:08 ` [PATCH 01/19] init: add DPS root partition type UUID capability Vincent Mailhol
2026-06-15 16:08 ` [PATCH 02/19] alpha: define DPS root partition type UUID Vincent Mailhol
2026-06-15 16:08 ` [PATCH 03/19] arc: " Vincent Mailhol
2026-06-15 16:09 ` [PATCH 04/19] arm: " Vincent Mailhol
2026-06-15 16:09 ` [PATCH 05/19] arm64: " Vincent Mailhol
2026-06-15 16:09 ` [PATCH 06/19] loongarch: " Vincent Mailhol
2026-06-15 16:09 ` [PATCH 07/19] mips: define DPS root partition type UUIDs Vincent Mailhol
2026-06-15 16:09 ` [PATCH 08/19] parisc: define DPS root partition type UUID Vincent Mailhol
2026-06-15 20:02 ` James Bottomley
2026-06-15 20:27 ` Helge Deller
2026-06-15 20:43 ` Vincent Mailhol
2026-06-15 16:09 ` [PATCH 09/19] powerpc: define DPS root partition type UUIDs Vincent Mailhol
2026-06-15 16:09 ` [PATCH 10/19] riscv: " Vincent Mailhol
2026-06-15 16:09 ` [PATCH 11/19] s390: " Vincent Mailhol
2026-06-15 16:09 ` [PATCH 12/19] x86: " Vincent Mailhol
2026-06-15 16:46 ` Dave Hansen
2026-06-15 18:05 ` Matthew Wilcox
2026-06-15 20:39 ` Vincent Mailhol
2026-06-15 20:19 ` Vincent Mailhol
2026-06-15 16:09 ` [PATCH 13/19] block: store GPT partition type UUID Vincent Mailhol
2026-06-15 16:09 ` [PATCH 14/19] block: add early_lookup_bdev_by_type_uuid() Vincent Mailhol
2026-06-15 16:09 ` [PATCH 15/19] block: store GPT attributes as a raw value Vincent Mailhol
2026-06-15 16:09 ` Vincent Mailhol [this message]
2026-06-15 16:09 ` [PATCH 17/19] init: factor out root device lookup into lookup_root_device() Vincent Mailhol
2026-06-15 16:09 ` [PATCH 18/19] init: discover root by DPS partition type UUID Vincent Mailhol
2026-06-15 16:09 ` [PATCH 19/19] docs: document discoverable root partitions Vincent Mailhol
2026-06-15 17:04 ` [PATCH 00/19] init: discoverable root partitions, a.k.a. an omittable "root=" cmdline option Al Viro
2026-06-15 20:33 ` Vincent Mailhol
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=20260615-discoverable-root_partitions-v1-16-39c78fac42e2@kernel.org \
--to=mailhol@kernel.org \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=dave@stgolabs.net \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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