ia64 recently changed the default page size from 16KB to 64KB.  Trying
to analyze a dump taken on a 64KB system on a 16KB page system fails.
Fix this problem by reallocating and rereading the header when block_size
mismatches.

Signed-off-by: Robin Holt <[email protected]>

---
 diskdump.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Index: crash-4.0-7.5/diskdump.c
===================================================================
--- crash-4.0-7.5.orig/diskdump.c       2008-12-05 09:06:09.000000000 -0600
+++ crash-4.0-7.5/diskdump.c    2009-01-08 11:46:53.193321876 -0600
@@ -107,12 +107,13 @@ static int read_dump_header(char *file)
        struct disk_dump_sub_header *sub_header = NULL;
        struct kdump_sub_header *sub_header_kdump = NULL;
        int bitmap_len;
-       const int block_size = (int)sysconf(_SC_PAGESIZE);
+       int block_size = (int)sysconf(_SC_PAGESIZE);
        off_t offset;
        const off_t failed = (off_t)-1;
        ulong pfn;
        int i, j, max_sect_len;
 
+reread_block_size:
        if (block_size < 0)
                return FALSE;
 
@@ -147,6 +148,14 @@ static int read_dump_header(char *file)
                goto err;
        }
 
+       if (header->block_size != block_size) {
+               block_size = header->block_size;
+               free(header);
+               goto reread_block_size;
+       }
+       dd->block_size  = block_size;
+       dd->block_shift = ffs(block_size) - 1;
+
        if (CRASHDEBUG(1))
                fprintf(fp, "%s: header->utsname.machine: %s\n", 
                        DISKDUMP_VALID() ? "diskdump" : "compressed kdump",
@@ -165,15 +174,6 @@ static int read_dump_header(char *file)
            machine_type_mismatch(file, "PPC64", NULL, 0))
                goto err;
 
-       if (header->block_size != block_size) {
-               error(INFO, "%s: block size in the dump header does not match"
-                   " with system page size\n",
-                       DISKDUMP_VALID() ? "diskdump" : "compressed kdump");
-               goto err;
-       }
-       dd->block_size  = block_size;
-       dd->block_shift = ffs(block_size) - 1;
-
        if (sizeof(*header) + sizeof(void *) * header->nr_cpus > block_size ||
            header->nr_cpus <= 0) {
                error(INFO, "%s: invalid nr_cpus value: %d\n", 

--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to