On 03/04/15 at 01:07am, Minfei Huang wrote:
Enhance kdump to support bind mounted target, since kdump cann't
parse
the bind mounted path.
Following is the testcases which kdump can generate the core sucessfully.
1) rootfs, default path / specified path
2) rootfs with bind mounted path which is in the rootfs device
# cat /etc/kdump | grep ^path
path /var/crash
# mount -o bind /var/crash /mnt/crash
4) rootfs with bind mounted path which is not in the rootfs device
# cat /etc/kdump | grep ^path
path /var/crash
# mount /dev/vdb /mnt
# mount -o bind /var/crash /mnt/crash
5) no-rootfs
6) no-rootfs with bind mounted path which is in the same device
7) no-rootfs with bind mounted path which is not in the same device
8) nfs
9) nfs with bind mounted path which is under the nfs mount point path
# cat /etc/kdump | grep ^nfs
nfs 192.168.122.134:/opt/crash
# cat /etc/kdump | grep ^path
path /var/crash
# mount.nfs 192.168.122.134:/opt/crash /mnt/nfs
# mount -o bind /mnt/nfs/var/crash /mnt/nfs/dump
10) nfs with bind mounted path which is not under the nfs mount point path
# cat /etc/kdump | grep ^nfs
nfs 192.168.122.134:/opt/crash
# cat /etc/kdump | grep ^path
path /var/crash
# mount.nfs 192.168.122.134:/opt/crash /mnt/nfs
# mount -o bind /mnt/nfs/var/crash /mnt/dump
11) nfs which don't specify the nfs option in the /etc/kdump, with bind mounted path
which is under the nfs mount point path
# cat /etc/kdump | grep ^nfs
# mount.nfs 192.168.122.134:/opt/crash /mnt/nfs
# cat /etc/kdump | grep ^path
path /mnt/nfs/var/crash
# mount -o bind /mnt/nfs/var/crash /mnt/nfs/dump
12) nfs which don't specify the nfs option in the /etc/kdump, with bind mounted path
which is not under the nfs mount point path
# cat /etc/kdump | grep ^nfs
# mount.nfs 192.168.122.134:/opt/crash /mnt/nfs
# cat /etc/kdump | grep ^path
path /mnt/nfs/var/crash
# mount -o bind /mnt/nfs/var/crash /mnt/dump
13) ext4
14) ext4 with bind mounted path which is under the ext4 mount point path
15) ext4 with bind mounted path which is not under the ext4 mount point path
16) btrfs
17) btrfs with subvolume which mounts under mount point path
18) btrfs with subvolume which does not mount under mount point path
Minfei Huang (4):
kdump-lib: Add new function to cut out the substring
kdump-lib: Add the new function to enhance bind mounted judgement
kdump-lib: Get the mount point correctly, if the device has several
mount point
dracut-module-setup: Fix the incorrect dumping target, if the path is
bind mounted
dracut-module-setup.sh | 49 +++++++++++++++++++++++++++++++++++-----
kdump-lib.sh | 61 +++++++++++++++++++++++++++++++++++++++++++++++++-
mkdumprd | 32 +++++++++++++++++++-------
3 files changed, 128 insertions(+), 14 deletions(-)
There's some problems ie. umount original directory and only keep bind mounted one.
The cases looks complicated, I agree with Bao that it increases code complexity
dramaticlly so how about do it like below:
1) document that we do not support bind mount
2) for atomic, two ways to resolve the problem:
*) they can pack a different kdump.conf with different default path
*) we can fix it by conditionally set default path for atomic
Thanks
Dave