From cfaccc5fadb2fd1e1b81e5ecee670c01761653e3 Mon Sep 17 00:00:00 2001 From: Eduard Shishkin Date: Sat, 13 Apr 2024 11:57:36 +0200 Subject: [PATCH] zipl/src: Fix problems when image is not on target DASD This patch fixes a bug in disk_get_info() Steps to reproduce: Prepare a DASD disk for IPL, specifying an image ("-i IMAGE_NAME") located on SCSI (dm) and a target directory ("-t /mnt") located on DASD. Don't specify "-a" option. Actual result: "Run /lib/s390-tools//zipl_helper.device-mapper /mnt Error: Could not retrieve device-mapper information for device 'dasda1'" Expected result: "Run /lib/s390-tools//zipl_helper.device-mapper 253:4 Error: Could not add image file 'IMAGE_NAME': File is not on target device" The problem is in incorrect calculation by disk_get_info() parameters for @device associated with the image file. Specifically, @target->bootmap_dir is passed to the script, which is wrong. Fixup: Get rid of bogus branching in disk_get_info() in case when target parameters are evaluated in "source_script" mode. Always pass major and minor of the @device (whose parameters to be calculated) to the helper script. Signed-off-by: Eduard Shishkin Reviewed-by: Stefan Haberland Signed-off-by: Steffen Eiden --- zipl/src/disk.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/zipl/src/disk.c b/zipl/src/disk.c index 200fae68..6dd0628d 100644 --- a/zipl/src/disk.c +++ b/zipl/src/disk.c @@ -246,15 +246,9 @@ disk_get_info(const char* device, struct job_target_data* target, (!stat(script_file, &script_stats))) { data->source = source_script; /* Run targetbase script */ - if (target->bootmap_dir == NULL) { - /* happens in case of partition dump */ - misc_asprintf(&ppn_cmd, "%s %d:%d", - script_file, major(stats.st_rdev), - minor(stats.st_rdev)); - } else { - misc_asprintf(&ppn_cmd, "%s %s", - script_file, target->bootmap_dir); - } + misc_asprintf(&ppn_cmd, "%s %d:%d", + script_file, major(stats.st_rdev), + minor(stats.st_rdev)); printf("Run %s\n", ppn_cmd); fh = popen(ppn_cmd, "r"); if (fh == NULL) {