On 05/11/2020 02:42 PM, Kairui Song wrote:
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.
With both nofail and x-systemd.before=kdump-capture.service, systemd
will try to mount the dump target before calling kdump, and even if the
mount failed, kdump.sh 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.
I had thought about the asymmetry
after the previous partial revert
patch, and its value. And this patch resolves it!
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.
---
mkdumprd | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mkdumprd b/mkdumprd
index cedf536..26e71ba 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=kdump-capture.service"
_mntopts="$_target $_fstype $_options"
#for non-nfs _dev converting to use udev persistent name
Acked-by: Pingfan Liu <piliu(a)redhat.com>