From 539bff40830e961d7ef85248e39bff0e40b23c91 Mon Sep 17 00:00:00 2001 From: Kairui Song Date: Mon, 11 May 2020 14:32:05 +0800 Subject: [PATCH] Append both nofail and x-systemd.before to kdump mount target By this point, there is still an unresolved vfs kernel issue that blocks systemd from mounting the dump target properly from time to time. To prevent systemd from failing by mounting the dump target, we can add nofail option to the kdump mount point. But adding nofail will wipe out default dependency of the mount point, see commit 94a7b43, so systemd randomize the order of calling kdump.sh and mounting the dump target and lead to unexpected behavior. However we can use x-systemd.before to ensure the mount is done in right order. In dracut-kdump-capture.service, we have "After=initrd.target", and look at dracut.bootup.7, systems start processing of fstab by initrd-fs.target, so set "After=initrd.target" could ensure the mount is ready before pre-pivot and kdump-capture service. Now with both nofail and x-systemd.before=initrd.target, systemd will try to mount the dump target before calling kdump, and even if the mount failed, kdump.sh will still be called and try to mount again. See dump_fs function, which will try to mount if the target is not mounted. Kdump will only fail if both mount attemp fails. Else if the kdump target mount failed or unstable, systemd will directly jump to kdump failure action, and kdump fails. This should improve the robustness in general with no other risk. Signed-off-by: Kairui Song Acked-by: Pingfan Liu --- mkdumprd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mkdumprd b/mkdumprd index cedf536..a8f41d4 100644 --- a/mkdumprd +++ b/mkdumprd @@ -83,6 +83,9 @@ to_mount() { # drop nofail or nobootwait _options=$(echo $_options | sed 's/\(^\|,\)nofail\($\|,\)/\1/g') _options=$(echo $_options | sed 's/\(^\|,\)nobootwait\($\|,\)/\1/g') + # use both nofail and x-systemd.before to ensure systemd will try best to + # mount it before kdump starts, this is an attempt to improve robustness + _options="$_options,nofail,x-systemd.before=initrd-fs.target" _mntopts="$_target $_fstype $_options" #for non-nfs _dev converting to use udev persistent name