From: Cliff Wickman <cpw@sgi.com>
To: kexec@lists.infradead.org
Subject: [PATCH] makedumpfile: output files filling ramdisk
Date: Wed, 16 Jun 2010 08:51:04 -0500 [thread overview]
Message-ID: <E1OOt1E-0001GS-Ih@eag09.americas.sgi.com> (raw)
Tested on SGI UV, which is x86_64.
makedumpfile's path FILENAME_BITMAP "/tmp/..." causes it to try to write
bitmap files to the ramdisk. These can be very large if the machine has
lots of memory, and so writing the file can fail.
(makedumpfile is exec'd by kdumptool. And kdumptool should chroot to
its --root directory. But if the intent is to avoid this problem it
doesn't seem to work. That may be the proper fix, rather than the below.)
A TMPDIR environment variable is set in the script
/lib/mkinitrd/scripts/boot-kdump.sh. So this patch assumes that
the FILENAME_BITMAP path should be based at TMPDIR.
Diffed against makedumpfile-1.3.5
Signed-off-by: Cliff Wickman <cpw@sgi.com>
---
makedumpfile.c | 13 ++++++++++---
makedumpfile.h | 4 ++--
2 files changed, 12 insertions(+), 5 deletions(-)
Index: makedumpfile-1.3.5/makedumpfile.c
===================================================================
--- makedumpfile-1.3.5.orig/makedumpfile.c
+++ makedumpfile-1.3.5/makedumpfile.c
@@ -933,14 +933,21 @@ int
open_dump_bitmap(void)
{
int i, fd;
+ char *tmpname;
- if ((info->name_bitmap
- = (char *)malloc(sizeof(FILENAME_BITMAP))) == NULL) {
+ tmpname = getenv("TMPDIR");
+ if (!tmpname)
+ tmpname = "/tmp";
+
+ if ((info->name_bitmap = (char *)malloc(sizeof(FILENAME_BITMAP) +
+ strlen(tmpname) + 1)) == NULL) {
ERRMSG("Can't allocate memory for the filename. %s\n",
strerror(errno));
return FALSE;
}
- strcpy(info->name_bitmap, FILENAME_BITMAP);
+ strcpy(info->name_bitmap, tmpname);
+ strcat(info->name_bitmap, "/");
+ strcat(info->name_bitmap, FILENAME_BITMAP);
if ((fd = mkstemp(info->name_bitmap)) < 0) {
ERRMSG("Can't open the bitmap file(%s). %s\n",
info->name_bitmap, strerror(errno));
Index: makedumpfile-1.3.5/makedumpfile.h
===================================================================
--- makedumpfile-1.3.5.orig/makedumpfile.h
+++ makedumpfile-1.3.5/makedumpfile.h
@@ -230,7 +230,7 @@ do { \
#define BUFSIZE_FGETS (1500)
#define BUFSIZE_BITMAP (4096)
#define PFN_BUFBITMAP (BITPERBYTE*BUFSIZE_BITMAP)
-#define FILENAME_BITMAP "/tmp/kdump_bitmapXXXXXX"
+#define FILENAME_BITMAP "kdump_bitmapXXXXXX"
#define FILENAME_STDOUT "STDOUT"
/*
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next reply other threads:[~2010-06-16 13:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-16 13:51 Cliff Wickman [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-06-15 19:49 [PATCH] makedumpfile: output files filling ramdisk Cliff Wickman
2010-06-16 6:06 ` Masayuki Igawa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1OOt1E-0001GS-Ih@eag09.americas.sgi.com \
--to=cpw@sgi.com \
--cc=kexec@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox