zipl/src: Fix dump job on tape devices

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 <zaslonko@linux.ibm.com>
Reviewed-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Eduard Shishkin
2026-02-04 15:26:30 +01:00
committed by Jan Höppner
parent 47cac92ca2
commit 5c2e6fd730
3 changed files with 17 additions and 11 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);