Blame SOURCES/kexec-tools-2.0.4-makedumpfile-Fall-back-to-read-when-mmap-fails.patch

765b01
From 7c770ed052d8452f5d7ce027b23d1b77cf6fbce7 Mon Sep 17 00:00:00 2001
765b01
From: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
765b01
Date: Thu, 12 Dec 2013 16:40:31 +0900
765b01
Subject: [PATCH 2/2] [PATCH] Fall back to read() when mmap() fails.
765b01
765b01
This is a fall back path for mmap().
765b01
This patch disables mmap() when facing the issues related to mmap(),
765b01
and read() will be used to read vmcore instead.
765b01
765b01
Signed-off-by: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
765b01
---
765b01
 makedumpfile.c | 10 +++++++++-
765b01
 1 file changed, 9 insertions(+), 1 deletion(-)
765b01
765b01
diff --git a/makedumpfile-1.5.4/makedumpfile.c b/makedumpfile-1.5.4/makedumpfile.c
765b01
index b3af28b..20f107e 100644
765b01
--- a/makedumpfile-1.5.4/makedumpfile.c
765b01
+++ b/makedumpfile-1.5.4/makedumpfile.c
765b01
@@ -324,7 +324,15 @@ read_from_vmcore(off_t offset, void *bufptr, unsigned long size)
765b01
 		if (!read_with_mmap(offset, bufptr, size)) {
765b01
 			ERRMSG("Can't read the dump memory(%s) with mmap().\n",
765b01
 			       info->name_memory);
765b01
-			return FALSE;
765b01
+
765b01
+			ERRMSG("This kernel might have some problems about mmap().\n");
765b01
+			ERRMSG("read() will be used instead of mmap() from now.\n");
765b01
+
765b01
+			/*
765b01
+			 * Fall back to read().
765b01
+			 */
765b01
+			info->flag_usemmap = MMAP_DISABLE;
765b01
+			read_from_vmcore(offset, bufptr, size);
765b01
 		}
765b01
 	} else {
765b01
 		if (lseek(info->fd_memory, offset, SEEK_SET) == failed) {
765b01
-- 
765b01
1.8.4.2
765b01