Blame SOURCES/kexec-tools-2.0.20-makedumpfile-assign-bitmap1-2-fd-for-subprocess-in-non-cycl.patch

bda30f
From 5519b3eba68544dc484d85e9540d440d93f8c924 Mon Sep 17 00:00:00 2001
bda30f
From: Pingfan Liu <piliu@redhat.com>
bda30f
Date: Tue, 3 Dec 2019 15:37:07 +0800
bda30f
Subject: [PATCH] [PATCH] assign bitmap1/2 fd for subprocess in non-cyclic mode
bda30f
bda30f
In non-cyclic mode with the --split option, each subprocess inherits
bda30f
bitmap1/2->fd from parent.  Then they lseek()/read() on the same fd,
bda30f
which means that they interfere with each other.
bda30f
bda30f
This breaks the purpose of SPLITTING_FD_BITMAP(i) for each subprocess.
bda30f
Without this patch, makedumpfile can fail with error like the following
bda30f
in refiltering, or can break the dumpfile silently by excluding pages
bda30f
wrongly.
bda30f
bda30f
  readpage_kdump_compressed: pfn(2fc1000) is excluded from vmcore.
bda30f
  readmem: type_addr: 1, addr:2fc1000000, size:4096
bda30f
  read_pfn: Can't get the page data.
bda30f
bda30f
Fix it by assigning a subprocess dedicated fd to bitmap1/2->fd.
bda30f
bda30f
Signed-off-by: Pingfan Liu <piliu@redhat.com>
bda30f
Signed-off-by: Kazuhito Hagio <k-hagio@ab.jp.nec.com>
bda30f
---
bda30f
 makedumpfile.c | 4 ++++
bda30f
 1 file changed, 4 insertions(+)
bda30f
bda30f
diff --git a/makedumpfile-1.6.6/makedumpfile.c b/makedumpfile-1.6.6/makedumpfile.c
bda30f
index 43107d9..7586d7c 100644
bda30f
--- a/makedumpfile-1.6.6/makedumpfile.c
bda30f
+++ b/makedumpfile-1.6.6/makedumpfile.c
bda30f
@@ -10091,6 +10091,10 @@ writeout_multiple_dumpfiles(void)
bda30f
 			info->split_start_pfn = SPLITTING_START_PFN(i);
bda30f
 			info->split_end_pfn   = SPLITTING_END_PFN(i);
bda30f
 
bda30f
+			if (!info->flag_cyclic) {
bda30f
+				info->bitmap1->fd = info->fd_bitmap;
bda30f
+				info->bitmap2->fd = info->fd_bitmap;
bda30f
+			}
bda30f
 			if (!reopen_dump_memory())
bda30f
 				exit(1);
bda30f
 			if ((status = writeout_dumpfile()) == FALSE)
bda30f
-- 
bda30f
2.7.5
bda30f