Blob Blame History Raw
From 5519b3eba68544dc484d85e9540d440d93f8c924 Mon Sep 17 00:00:00 2001
From: Pingfan Liu <piliu@redhat.com>
Date: Tue, 3 Dec 2019 15:37:07 +0800
Subject: [PATCH] [PATCH] assign bitmap1/2 fd for subprocess in non-cyclic mode

In non-cyclic mode with the --split option, each subprocess inherits
bitmap1/2->fd from parent.  Then they lseek()/read() on the same fd,
which means that they interfere with each other.

This breaks the purpose of SPLITTING_FD_BITMAP(i) for each subprocess.
Without this patch, makedumpfile can fail with error like the following
in refiltering, or can break the dumpfile silently by excluding pages
wrongly.

  readpage_kdump_compressed: pfn(2fc1000) is excluded from vmcore.
  readmem: type_addr: 1, addr:2fc1000000, size:4096
  read_pfn: Can't get the page data.

Fix it by assigning a subprocess dedicated fd to bitmap1/2->fd.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
Signed-off-by: Kazuhito Hagio <k-hagio@ab.jp.nec.com>
---
 makedumpfile.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/makedumpfile-1.6.6/makedumpfile.c b/makedumpfile-1.6.6/makedumpfile.c
index 43107d9..7586d7c 100644
--- a/makedumpfile-1.6.6/makedumpfile.c
+++ b/makedumpfile-1.6.6/makedumpfile.c
@@ -10091,6 +10091,10 @@ writeout_multiple_dumpfiles(void)
 			info->split_start_pfn = SPLITTING_START_PFN(i);
 			info->split_end_pfn   = SPLITTING_END_PFN(i);
 
+			if (!info->flag_cyclic) {
+				info->bitmap1->fd = info->fd_bitmap;
+				info->bitmap2->fd = info->fd_bitmap;
+			}
 			if (!reopen_dump_memory())
 				exit(1);
 			if ((status = writeout_dumpfile()) == FALSE)
-- 
2.7.5