zipl/src: fix bugs in SCSI dump installation

This fixes d6b702d57 which introduces a problem: SCSI dump
installation fails:

zipl -V -d /dev/mapper/mpathd1
Error: Invalid dump device: Could not read partition table

The reasons:
1) Wrong (logical) device is passed as a target base;
2) In case of 'source_script' the check to make sure that specified
   target is over a partition isn't applicable any more after zipl
   support of complex logical targets (e.g. mirrors).

The fixup passes the physical device as a target base (instead of
the logical one). Also the fixup removes invalid check from
check_dump_device_late() and instead adds a more generic check to
the helper script that data starts beyong the boot area.

Reported-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com>
Tested-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Eduard Shishkin
2024-09-04 10:20:13 +02:00
committed by Jan Höppner
parent 136e5eed8c
commit f43789e16a
2 changed files with 19 additions and 5 deletions

View File

@@ -971,9 +971,18 @@ check_dump_device_late(char *partition, struct disk_info *target_info,
return rc;
}
if ((job->is_ldipl_dump && info->type != disk_type_eckd_cdl) ||
(!job->is_ldipl_dump && info->type != disk_type_scsi) ||
info->partnum == 0) {
error_reason("Device '%s' is not a SCSI or DASD partition",
(!job->is_ldipl_dump && info->type != disk_type_scsi)) {
error_reason("Device '%s' is not of SCSI or DASD-CDL type",
partition);
disk_free_info(info);
return -1;
}
/*
* Check that data starts beyong the boot area on the base disk.
* In case of source_script the check is performed by the script
*/
if (target->source == source_auto && info->partnum == 0) {
error_reason("Device '%s' is not a partition",
partition);
disk_free_info(info);
return -1;
@@ -1489,7 +1498,7 @@ static int prepare_build_program_table_device(struct job_data *job,
printf("Target device information\n");
disk_print_info(bis->info, job->target.source);
}
if (misc_temp_dev(bis->info->device, 1, &bis->basetmp[0]))
if (misc_temp_dev(bis->info->basedisks[0], 1, &bis->basetmp[0]))
return -1;
if (check_dump_device(job, bis->info, bis->basetmp[0]))
return -1;
@@ -1710,7 +1719,7 @@ static int prepare_bootloader_ngdump(struct job_data *job,
/* Retrieve target device information */
if (disk_get_info(job->data.dump.device, &job->target, &info))
return -1;
if (misc_temp_dev(info->device, 1, &bis->basetmp[0]))
if (misc_temp_dev(info->basedisks[0], 1, &bis->basetmp[0]))
return -1;
if (check_dump_device(job, info, bis->basetmp[0]))
return -1;

View File

@@ -1364,6 +1364,11 @@ static int dm_dev_to_zipl_params(struct ext_dev *dev, char *dir)
return -1;
if (complete_physical_device(&pd, &base_dev))
goto error;
if (pd.offset < pd.dc.bootsectors) {
ERR("Unsupported setup: data starts at boot area on (%u:%u)\n",
major(base_dev), minor(base_dev));
return -1;
}
base_dev_to_params(base_dev, &pd.dc, pd.offset);
if (pd.mirror) {