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: 271b809495 ("zdump/dfi_s390: Support reading compressed s390_ext dumps")
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
Mikhail Zaslonko
2024-05-08 13:00:45 +02:00
committed by Steffen Eiden
parent 7a4ec55d77
commit c7fd515790

View File

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