From d4f04afa47dea89ad5ca42ad0b2ddc355ce93a64 Mon Sep 17 00:00:00 2001 From: Kairui Song Date: Wed, 21 Nov 2018 17:08:13 +0800 Subject: [PATCH] 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 Acked-by: Dave Young --- mkdumprd | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mkdumprd b/mkdumprd index 078f988..a6f7fe8 100644 --- a/mkdumprd +++ b/mkdumprd @@ -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//')