kdumpctl: check /etc/fstab modification only when it exists

On a diskless client /etc/fstab does not exist. Therefore check
modification time of this file for rebuild only if it exists.

Also use --fstab option with findmnt only when /etc/fstab exists.

Signed-off-by: Pratyush Anand <panand@redhat.com>
Reviewed-by: Xunlei Pang <xlpang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
Pratyush Anand 2016-09-14 20:12:17 +05:30 committed by Dave Young
parent 9b95184251
commit 1bb23e7536
2 changed files with 3 additions and 2 deletions

View File

@ -345,7 +345,8 @@ check_files_modified()
EXTRA_BINS="$EXTRA_BINS $CHECK_FILES" EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
CHECK_FILES=`grep ^extra_bins $KDUMP_CONFIG_FILE | cut -d\ -f2-` CHECK_FILES=`grep ^extra_bins $KDUMP_CONFIG_FILE | cut -d\ -f2-`
EXTRA_BINS="$EXTRA_BINS $CHECK_FILES" EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS /etc/fstab" files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS"
[[ -e /etc/fstab ]] && files="$files /etc/fstab"
check_exist "$files" && check_executable "$EXTRA_BINS" check_exist "$files" && check_executable "$EXTRA_BINS"
[ $? -ne 0 ] && return 2 [ $? -ne 0 ] && return 2

View File

@ -104,7 +104,7 @@ to_mount() {
fi fi
_fstype=$(findmnt -k -f -n -r -o FSTYPE $_dev) _fstype=$(findmnt -k -f -n -r -o FSTYPE $_dev)
_options=$(findmnt --fstab -f -n -r -o OPTIONS $_dev) [[ -e /etc/fstab ]] && _options=$(findmnt --fstab -f -n -r -o OPTIONS $_dev)
[ -z "$_options" ] && _options=$(findmnt -k -f -n -r -o OPTIONS $_dev) [ -z "$_options" ] && _options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
# with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd # with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
# kernel, filter it out here. # kernel, filter it out here.