From: Chanho Min <chanho.min@lge.com>
To: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Sven <dm-devel@schwermer.no>, Neil Brown <neilb@suse.de>,
hch@lst.de, dm-devel@lists.linux.dev,
Gunho Lee <gunho.lee@lge.com>, Chanho Min <chanho.min@lge.com>
Subject: [PATCH] block: remove non-existent partition dev_t return from blk_lookup_devt
Date: Thu, 3 Apr 2025 09:35:32 +0900 [thread overview]
Message-ID: <20250403003532.412-1-chanho.min@lge.com> (raw)
We encountered frequent boot failures while setting up a dm-verity rootfs with
the following configuration, and found that this issue had been reported
previously:
root=/dev/dm-0
dm-mod.waitfor=/dev/mmcblk0p23
The error observed was:
device-mapper: table: 254:0: verity: Data device lookup failed (-ENXIO)
device-mapper: ioctl: error adding target to table
Bisecting the issue revealed that this was a latent problem exacerbated by
commit 238d991f054a ("dm: use fsleep() instead of msleep() for deterministic
sleep duration"), after which the failures became more frequent. Further
investigation pinpointed the root cause to a special case added in
blk_lookup_devt() by commit 41b8c853a495 ("block: fix booting from partitioned
md array")
This commit modified blk_lookup_devt() to return a dev_t for non-existent
partitions to support MD RAID booting when partitions are not yet available,
e.g., for root=/dev/md_d0p1. While this addressed the MD issue, it deviates
from the expected role of blk_lookup_devt(), which should return a dev_t only
for existing block devices. Adding MD-specific logic to a common block layer
function was a suboptimal approach, as it compromises the function's clarity
and causes side effects, such as the dm-init failures seen with dm-verity.
The MD RAID booting issue should ideally have been handled within the MD
driver or boot logic (e.g., via a dedicated md_lookup_devt() function) rather
than modifying a generic lookup function. This patch removes the non-existent
partition dev_t return logic, restoring blk_lookup_devt() to its intended
purpose. This resolves the dm-verity boot failures by ensuring accurate dev_t
returns.
If MD RAID booting still depends on this behavior in some setups, a regression
may occur. In that case, the MD subsystem should implement a proper solution
(e.g., specific lookup function) rather than relying on this workaround.
Testers are encouraged to verify MD RAID booting with partitioned root devices
(e.g., root=/dev/md_d0p1) to confirm.
Signed-off-by: Chanho Min <chanho.min@lge.com>
---
block/early-lookup.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/block/early-lookup.c b/block/early-lookup.c
index 3fb57f7d2b127..3764dfb429c54 100644
--- a/block/early-lookup.c
+++ b/block/early-lookup.c
@@ -134,17 +134,9 @@ static dev_t __init blk_lookup_devt(const char *name, int partno)
if (strcmp(dev_name(dev), name))
continue;
- if (partno < disk->minors) {
- /* We need to return the right devno, even
- * if the partition doesn't exist yet.
- */
- devt = MKDEV(MAJOR(dev->devt),
- MINOR(dev->devt) + partno);
- } else {
- devt = part_devt(disk, partno);
- if (devt)
- break;
- }
+ devt = part_devt(disk, partno);
+ if (devt)
+ break;
}
class_dev_iter_exit(&iter);
return devt;
--
2.17.1
next reply other threads:[~2025-04-03 1:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-03 0:35 Chanho Min [this message]
2025-04-04 9:20 ` Christoph Hellwig
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=20250403003532.412-1-chanho.min@lge.com \
--to=chanho.min@lge.com \
--cc=axboe@kernel.dk \
--cc=dm-devel@lists.linux.dev \
--cc=dm-devel@schwermer.no \
--cc=gunho.lee@lge.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.de \
/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
all inboxes | Powered by JetHome®