From 5c2e6fd7300d959daaea8e05760670c1e2869ca9 Mon Sep 17 00:00:00 2001 From: Eduard Shishkin Date: Wed, 4 Feb 2026 15:26:30 +0100 Subject: [PATCH] zipl/src: Fix dump job on tape devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix incorrect handling of tape devices leading to inability of creating dumps on them. Make the check for tape device go first, to not miss it on irrelevant errors Reported-by: Mikhail Zaslonko Reviewed-by: Mikhail Zaslonko Signed-off-by: Eduard Shishkin Signed-off-by: Jan Höppner --- zipl/include/disk.h | 6 +++--- zipl/src/disk.c | 17 ++++++++++++----- zipl/src/zipl.c | 5 ++--- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/zipl/include/disk.h b/zipl/include/disk.h index c131b071..cce69f73 100644 --- a/zipl/include/disk.h +++ b/zipl/include/disk.h @@ -59,6 +59,7 @@ typedef enum { struct disk_ext_type { disk_type_t type; bool is_nvme; + bool is_tape; }; /* targetbase definition */ @@ -106,9 +107,8 @@ struct job_target_data; int device_get_info(const char *device, struct job_target_data *target, struct device_info **info); -int disk_get_ext_type(const char *device, struct disk_ext_type *ext_type, - int disk_id); -int disk_is_tape(const char *device); +int dump_disk_get_ext_type(const char *device, struct disk_ext_type *ext_type); +int disk_type_is_tape(struct disk_ext_type *ext_type); int disk_type_is_scsi(struct disk_ext_type *ext_type); int disk_type_is_eckd_ldl(struct disk_ext_type *ext_type); int disk_type_is_nvme(struct disk_ext_type *ext_type); diff --git a/zipl/src/disk.c b/zipl/src/disk.c index 44970a1d..3e45d0c7 100644 --- a/zipl/src/disk.c +++ b/zipl/src/disk.c @@ -721,8 +721,7 @@ error: return -1; } -int -disk_is_tape(const char* device) +static int disk_is_tape(const char *device) { int fd, rc = 0; @@ -744,16 +743,19 @@ disk_is_tape(const char* device) * partition, etc). In case of success the resulted disk type is * stored in EXT_TYPE. */ -int disk_get_ext_type(const char *device, struct disk_ext_type *ext_type, - int disk_idx) +int dump_disk_get_ext_type(const char *device, struct disk_ext_type *ext_type) { struct job_target_data tmp = {.source = source_unknown}; struct device_info *dev_info; struct disk_info *info; + if (disk_is_tape(device)) { + ext_type->is_tape = 1; + return 0; + } if (device_get_info(device, &tmp, &dev_info)) return -1; - info = &dev_info->base[disk_idx]; + info = &dev_info->base[0]; ext_type->type = info->type; ext_type->is_nvme = info->is_nvme; @@ -762,6 +764,11 @@ int disk_get_ext_type(const char *device, struct disk_ext_type *ext_type, return 0; } +int disk_type_is_tape(struct disk_ext_type *ext_type) +{ + return ext_type->is_tape; +} + int disk_type_is_scsi(struct disk_ext_type *ext_type) { return ext_type->type == disk_type_scsi; diff --git a/zipl/src/zipl.c b/zipl/src/zipl.c index d8e71470..4992d937 100644 --- a/zipl/src/zipl.c +++ b/zipl/src/zipl.c @@ -174,13 +174,12 @@ main(int argc, char* argv[]) /* Do it */ switch (job->id) { case job_dump_partition: - rc = disk_get_ext_type(job->data.dump.device, &ext_type, - 0 /* disk index */); + rc = dump_disk_get_ext_type(job->data.dump.device, &ext_type); if (rc) break; job_dump_check_set_ngdump(job, &ext_type); if (!job_dump_is_ngdump(job) && - (disk_is_tape(job->data.dump.device) || + (disk_type_is_tape(&ext_type) || !disk_type_is_scsi(&ext_type))) { rc = install_dump(job->data.dump.device, &job->target, job->data.dump.mem, job->data.dump.no_compress);