When open_files_for_creating_dumpfile() is called, we don't have all necessary information to determine whether a bitmap file is actually needed. In particular, we don't know whether info->flag_cyclic will ultimately be set. This patch moves the call to open_dump_bitmap() to after initialize() when all flags are known. For the dump_dmesg() path, no bitmap file is needed. Signed-off-by: Martin Wilck <mwilck at suse.de> --- makedumpfile.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/makedumpfile.c b/makedumpfile.c index 6164468..30e1fa8 100644 --- a/makedumpfile.c +++ b/makedumpfile.c @@ -1480,9 +1480,6 @@ open_files_for_creating_dumpfile(void) if (!open_dump_memory()) return FALSE; - if (!open_dump_bitmap()) - return FALSE; - return TRUE; } @@ -9747,6 +9744,9 @@ create_dumpfile(void) if (!initial()) return FALSE; + if (!open_dump_bitmap()) + return FALSE; + /* create an array of translations from pfn to vmemmap pages */ if (info->flag_excludevm) { if (find_vmemmap() == FAILED) { @@ -10917,6 +10917,9 @@ int show_mem_usage(void) if (!initial()) return FALSE; + if (!open_dump_bitmap()) + return FALSE; + if (!prepare_bitmap_buffer()) return FALSE; -- 2.9.3