Bug 607404

Summary: UV support: makedumpfile: output files filling ramdisk
Product: Red Hat Enterprise Linux 6 Reporter: George Beshers <gbeshers>
Component: kexec-toolsAssignee: Cong Wang <amwang>
Status: CLOSED CURRENTRELEASE QA Contact: Han Pingtian <phan>
Severity: high Docs Contact:
Priority: high    
Version: 6.0CC: cye, dwa, martinez, qcai, rkhan, tee
Target Milestone: rc   
Target Release: 6.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: kexec-tools-2_0_0-108_el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-15 14:29:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 555548    

Description George Beshers 2010-06-24 02:24:49 UTC
David,
Again the patches are upstream and may already be in the RHEL
packages - I have not checked.

George


Description:

A fix for the makedumpfile command is needed to make dumps work on UV.

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.

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.

The patch looks like this:

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"

 /*
@@ -449,7 +449,7 @@ do { \
 #define KVER_MIN_SHIFT 16
 #define KERNEL_VERSION(x,y,z) (((x) << KVER_MAJ_SHIFT) | ((y) << KVER_MIN_SHIFT) | (z))
 #define OLDEST_VERSION         KERNEL_VERSION(2, 6, 15)/* linux-2.6.15 */
-#define LATEST_VERSION         KERNEL_VERSION(2, 6, 31)/* linux-2.6.31 */
+#define LATEST_VERSION         KERNEL_VERSION(2, 6, 32)/* linux-2.6.32 */

 /*
  * vmcoreinfo in /proc/vmcore


This patch is now upstream.  The original patch was separated into 2 patches
at Masayuki's request.  Both are applied.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 2 RHEL Program Management 2010-06-24 02:52:53 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 4 Marizol Martinez 2010-07-08 15:31:44 UTC
George -- Per your comment in the description, please verify and update this BZ
accordingly. Thanks!

Comment 5 Cong Wang 2010-07-09 07:37:15 UTC
Please don't copy and paste the patch into BZ. Attach it as a patch please.

Comment 7 releng-rhel@redhat.com 2010-11-15 14:29:13 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.