From b09a9b34905c05d4145a6b690581308c5cd85fac Mon Sep 17 00:00:00 2001 From: Eduard Shishkin Date: Thu, 16 Jan 2025 16:51:49 +0100 Subject: [PATCH] zipl_helper.device-mapper: Fix logical device resolution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported issue: \# lsblk sdc 8:32 0 20G 0 disk |-sdc1 8:33 0 20G 0 part `-mpatha 253:1 0 20G 0 mpath `-mpatha1 253:17 0 20G 0 part sdd 8:48 0 20G 0 disk |-sdd1 8:49 0 20G 0 part `-mpatha 253:1 0 20G 0 mpath `-mpatha1 253:17 0 20G 0 part \# zipl -d /dev/mapper/mpatha1 Success \# zgetdump -d /dev/mapper/mpatha zgetdump: No dump tool found on "/dev/mapper/mpatha" The root cause is in incorrect logical device resolution: \# zipl_helper.device-mapper 253:17 Expected result: targetbase=253:1 targettype=SCSI targetblocksize=512 targetoffset=2048 Actual result: targetbase=8:48 targettype=SCSI targetblocksize=512 targetoffset=2048 Do not resolve dm device which provides access to boot sectors. Fixes: 3db20bccefdb ("zipl_helper.device-mapper: Add missed step in logical device resolution") Signed-off-by: Eduard Shishkin Reported-by: Mikhail Zaslonko Tested-by: Mikhail Zaslonko Acked-by: Mikhail Zaslonko Signed-off-by: Jan Höppner --- zipl/src/zipl_helper.device-mapper.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/zipl/src/zipl_helper.device-mapper.c b/zipl/src/zipl_helper.device-mapper.c index 73862ea9..335cca46 100644 --- a/zipl/src/zipl_helper.device-mapper.c +++ b/zipl/src/zipl_helper.device-mapper.c @@ -1312,7 +1312,14 @@ static int complete_physical_device(struct physical_device *pd, dev_t *base_dev) base_entry = find_base_entry(pd->dmpath, dc->bootsectors); if (!base_entry) return -1; - *base_dev = first_device_by_target_data(base_entry->target); + if (target_get_start(base_entry->target) == 0) { + /* base device is a dm device */ + *base_dev = base_entry->dev.dev; + } else { + /* base device is a non-dm device */ + *base_dev = + first_device_by_target_data(base_entry->target); + } } /* Check for valid offset of filesystem */ if ((pd->offset % (dc->blocksize / SECTOR_SIZE)) != 0) {