This is based on previous clean up patches in:
[PATCH 0/5] Simplify bind mount handling and clean up
Currently kexec-tools always depend on dump target to be mounted, which
caused some inconvenience for setup.
So for user configured target, allow kdump to start and build initramfs
even if target is not mounted.
When a mounted user configured target is used, the behavior is not
changed.
When a unmounted user configured target is used, mkdumprd will look for
corresponding mount info in fstab, and a entry with noauto option is
founded, mkdumprd will try to mount it inplace with optoins specified
in fstab and do basic checks on the device, then umount it.
If there is no fstab entry, mkdumprd will try to mount it in temporary
path with defaults option, do same basic check and umount it.
If there is a fstab entry but "noauto" option is not used, then there
must be some reason that the target device is not mounted, mkdumprd will
error out.
When path based target is used, there is no behavior change.
Some examples:
Example 1, target is mounted
kdump.conf:
nfs 192.168.122.1:/srv/local/nfs
path /var/crash
core_collector makedumpfile -l --message-level 1 -d 31
mount info (from mount command):
192.168.122.1:/srv/local/nfs on /var/mnt/nfs2 type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.122.249,local_lock=none,addr=192.168.122.1)
mkdumprd will just do do basic kdump checks (fs size, path
accisibility), and then build the initramfs using current mount
info (mount point, target and options from current system).
Example 2, target is not mounted, and marked noauto in fstab:
kdump.conf:
nfs 192.168.122.1:/srv/local/nfs
path /var/crash
core_collector makedumpfile -l --message-level 1 -d 31
fstab:
192.168.122.1:/srv/local/nfs /mnt/nfs nfs defaults,noauto 0 0
mkdumprd will try to mount 192.168.122.1:/srv/local/nfs on /mnt/nfs,
do basic kdump checks, and then build the initramfs using mount info
in fstab.
Example 3, target is not mounted, and no entry in fstab:
kdump.conf:
nfs 192.168.122.1:/srv/local/nfs
path /var/crash
core_collector makedumpfile -l --message-level 1 -d 31
fstab or current mount:
No info related to target.
mkdumprd will try to mount 192.168.122.1:/srv/local/nfs on
/tmp/mkdumprd.XXXXXX/target with "mount -o defaults", do basic
kdump checks, and then build the initramfs using defaults
options.
In second kernel, target will be mounted on /kdumproot using
default options.
Kairui Song (6):
Fix the problem that kdump prints redundant /
Add a is_mounted helper
Allow calling mkdumprd from kdumpctl even if targat not mounted
kdump-lib.sh: add fstab failback helper for getting mount info
User get_mount_info to replace findmnt calls
mkdumprd: generate usable kdump initramfs even target is not mounted
kdump-lib-initramfs.sh | 54 ++++++++---------
kdump-lib.sh | 58 +++++++++---------
kdumpctl | 9 +--
mkdumprd | 130 +++++++++++++++++++++++++++++------------
4 files changed, 153 insertions(+), 98 deletions(-)
--
2.24.1