From c7fd515790db978c4b3cf477e286684d25d2208a Mon Sep 17 00:00:00 2001 From: Mikhail Zaslonko Date: Wed, 8 May 2024 13:00:45 +0200 Subject: [PATCH] zdump: Fix 'zgetdump -i' ioctl error on s390 formatted dump file When dump is copied to the filesystem in s390 format, follow on 'zgetdump -i' can fail with ioctl error: # zgetdump /dev/dasdb1 -f s390 dump.s390 Format Info: Source: s390_ext Target: s390 Copying dump: 00000001 / 00008192 MB 00003688 / 00008192 MB 00006646 / 00008192 MB 00008192 / 00008192 MB Success: Dump has been copied # zgetdump -iVVVV dump.s390 zgetdump: Operation "BLKSSZGET" failed on "dump.s390" (Inappropriate ioctl for device) Call ioctl(BLKSSZGET) only for s390_ext dump format (dump can be stored on DASD partition only, not on the filesystem). For s390 format a blocksize is not required for dump processing since s390 dump data is not compressed. Fixes: 271b809495ee ("zdump/dfi_s390: Support reading compressed s390_ext dumps") Reviewed-by: Alexander Egorenkov Signed-off-by: Mikhail Zaslonko Signed-off-by: Steffen Eiden --- zdump/dfi_s390.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/zdump/dfi_s390.c b/zdump/dfi_s390.c index 64ebcee6..f3a1f82c 100644 --- a/zdump/dfi_s390.c +++ b/zdump/dfi_s390.c @@ -346,11 +346,19 @@ int dfi_s390_init_gen(bool extended) l.extended = extended; if (read_s390_hdr() != 0) return -ENODEV; - zg_ioctl(g.fh, BLKSSZGET, &l.blk_size, "BLKSSZGET", ZG_CHECK); - if (!extended) + if (!extended) { rc = mem_chunks_add(); - else + } else { + /* Dumps in s390_ext format can reside on DASD partition only */ + if (zg_type(g.fh) != ZG_TYPE_DASD_PART) + return -ENODEV; + /* + * A device block size is required for a decompression of + * s390_ext dump with compressed dump segments. + */ + zg_ioctl(g.fh, BLKSSZGET, &l.blk_size, "BLKSSZGET", ZG_CHECK); rc = mem_chunks_add_ext(); + } if (rc) return rc; rc = df_s390_cpu_info_add(&l.hdr, l.hdr.mem_size);