[kexec-tools] mount fail if its mount point doesn't exist in /sysroot

WANG Chao wangchao at fedoraproject.org
Tue Jan 13 05:17:23 UTC 2015


commit e08ef78a56cb7c433838450d2d2fbad014d2a2ff
Author: Baoquan He <bhe at redhat.com>
Date:   Sun Jan 4 13:49:43 2015 +0800

    mount fail if its mount point doesn't exist in /sysroot
    
    Jerry Hoemann reported a bug that a mount will fail when he installed
    a system with separate "/" "/var" and "/var/crash". That means root
    disk /dev/a mounted on /, and another disk /dev/b is mounted on /var,
    then the 3rd disk /dev/c mounted on /var/crash. Then kdump will fail
    since mount will fail.
    
    This is because the mount information will be written into
    /$mntimage/etc/fstab like below. And the dump target is /dev/c. However
    /dev/b is not related in kdump, its mount info is not necessary and not
    saved. So when go into kdump kernel, it will find there's not a crash
    dir under /sysroot/var. And in current implementation, if not a root
    disk dump, sysroot is a read-only mount, no dir can be created in this
    situation.
    
    /dev/disk/by-uuid/cdcf007a-b623-45ee-8d73-a8be0d372440 /sysroot/var/crash xfs rw,relatime,...,x-initrd.mount 0 2
    
    So in this patch, change the mount behavior to fix this bug. If dump
    target is a root disk, mount point is /sysroot. If dump target is not
    root, just mount it to /kdumproot/$_target. Now it works.
    
    Signed-off-by: Baoquan He <bhe at redhat.com>
    Acked-by: Dave Young <dyoung at redhat.com>
    Acked-by: WANG Chao <chaowang at redhat.com>
    Tested-by: Jerry Hoemann <jerry.hoemann at hp.com>

 mkdumprd |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/mkdumprd b/mkdumprd
index a30d9ca..4d251ba 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -101,8 +101,16 @@ to_mount() {
 
     _source=$(findmnt -k -f -n -r -o SOURCE $_dev)
     _target=$(findmnt -k -f -n -r -o TARGET $_dev)
-    # mount under /sysroot in 2nd kernel, and we umount -R /sysroot before exit
-    _target="/sysroot$_target"
+    # mount under /sysroot if dump to root disk or mount under
+    #/kdumproot/$_target in other cases in 2nd kernel. systemd
+    #will be in charge to umount it.
+
+    if [ "$_target" = "/" ];then
+        _target="/sysroot"
+    else
+        _target="/kdumproot/$_target"
+    fi
+
     _fstype=$(findmnt -k -f -n -r -o FSTYPE $_dev)
     _options=$(findmnt --fstab -f -n -r -o OPTIONS $_dev)
     [ -z "$_options" ] && _options=$(findmnt -k -f -n -r -o OPTIONS $_dev)


More information about the scm-commits mailing list