This is a backport of the following upstream commit:
commit be09b61
Author: Atsushi Kumagai <kumagai-atsushi(a)mxc.nes.nec.co.jp>
Date: Thu Dec 12 16:40:31 2013 +0900
Fall back to read() when mmap() fails.
This is a fall back path for mmap().
This patch disables mmap() when facing the issues related to mmap(),
and read() will be used to read vmcore instead.
mmap() file operation on vmcore is working properly when the page being
accessed has different attributes on different part (ie. two different type
of memory ranges are overlapping).
A fall back mechanism is introduced in this patch, in case mmap() fails,
switch to read() afterwards.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
...umpfile-Fall-back-to-read-when-mmap-fails.patch | 38 ++++++++++++++++++++++
kexec-tools.spec | 2 ++
2 files changed, 40 insertions(+)
create mode 100644
kexec-tools-2.0.4-makedumpfile-Fall-back-to-read-when-mmap-fails.patch
diff --git a/kexec-tools-2.0.4-makedumpfile-Fall-back-to-read-when-mmap-fails.patch
b/kexec-tools-2.0.4-makedumpfile-Fall-back-to-read-when-mmap-fails.patch
new file mode 100644
index 0000000..a4edb75
--- /dev/null
+++ b/kexec-tools-2.0.4-makedumpfile-Fall-back-to-read-when-mmap-fails.patch
@@ -0,0 +1,38 @@
+From 7c770ed052d8452f5d7ce027b23d1b77cf6fbce7 Mon Sep 17 00:00:00 2001
+From: Atsushi Kumagai <kumagai-atsushi(a)mxc.nes.nec.co.jp>
+Date: Thu, 12 Dec 2013 16:40:31 +0900
+Subject: [PATCH 2/2] [PATCH] Fall back to read() when mmap() fails.
+
+This is a fall back path for mmap().
+This patch disables mmap() when facing the issues related to mmap(),
+and read() will be used to read vmcore instead.
+
+Signed-off-by: Atsushi Kumagai <kumagai-atsushi(a)mxc.nes.nec.co.jp>
+---
+ makedumpfile.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/makedumpfile-1.5.4/makedumpfile.c b/makedumpfile-1.5.4/makedumpfile.c
+index b3af28b..20f107e 100644
+--- a/makedumpfile-1.5.4/makedumpfile.c
++++ b/makedumpfile-1.5.4/makedumpfile.c
+@@ -324,7 +324,15 @@ read_from_vmcore(off_t offset, void *bufptr, unsigned long size)
+ if (!read_with_mmap(offset, bufptr, size)) {
+ ERRMSG("Can't read the dump memory(%s) with mmap().\n",
+ info->name_memory);
+- return FALSE;
++
++ ERRMSG("This kernel might have some problems about mmap().\n");
++ ERRMSG("read() will be used instead of mmap() from now.\n");
++
++ /*
++ * Fall back to read().
++ */
++ info->flag_usemmap = MMAP_DISABLE;
++ read_from_vmcore(offset, bufptr, size);
+ }
+ } else {
+ if (lseek(info->fd_memory, offset, SEEK_SET) == failed) {
+--
+1.8.4.2
+
diff --git a/kexec-tools.spec b/kexec-tools.spec
index c83cc64..4bf50af 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -93,6 +93,7 @@ Patch612:
kexec-tools-2.0.4-makedumpfile-Understand-v3.11-rc4-dmesg.patch
Patch613:
kexec-tools-2.0.4-makedumpfile-Assign-non-printable-value-as-short-option.patch
Patch614: kexec-tools-2.0.4-makedumpfile-Add-help-and-man-message-for-help.patch
Patch615:
kexec-tools-2.0.4-makedumpfile-Add-non-mmap-option-to-disable-mmap-manually.patch
+Patch616: kexec-tools-2.0.4-makedumpfile-Fall-back-to-read-when-mmap-fails.patch
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@@ -139,6 +140,7 @@ tar -z -x -v -f %{SOURCE19}
%patch613 -p1
%patch614 -p1
%patch615 -p1
+%patch616 -p1
tar -z -x -v -f %{SOURCE13}
--
1.8.4.2