mkdumprd: drop some nfs mount options when reading from kernel

nfs service will append extra mount options to kernel mount options.
Those extra options represent current mounting details, but they may
not suitable for the second kernel. IP address may change, and we only
enable a single network stack (v4/v6), if nfs prefered another
network stack, inheriting the options will force nfs service to use
previous network stack and disable nfs's fallback mechanic and fail.

As nfs service have the capability to negotiate required protocols
and detect proper IP address, just drop those options and let nfs
automatically adapt the possible change in the second kernel.

Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
Kairui Song 2018-11-21 17:08:13 +08:00
parent 31222d611d
commit d4f04afa47

View File

@ -98,7 +98,14 @@ to_mount() {
_fstype=$(findmnt -k -f -n -r -o FSTYPE $_dev)
[[ -e /etc/fstab ]] && _options=$(findmnt --fstab -f -n -r -o OPTIONS $_dev)
[ -z "$_options" ] && _options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
if [ -z "$_options" ]; then
_options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
if [[ $_fstype == "nfs"* ]]; then
_options=$(echo $_options | sed 's/,addr=[^,]*//')
_options=$(echo $_options | sed 's/,proto=[^,]*//')
_options=$(echo $_options | sed 's/,clientaddr=[^,]*//')
fi
fi
# with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
# kernel, filter it out here.
_options=$(echo $_options | sed 's/\bnoauto\b//')