From 1bb23e753654493f0ad2131d66850484a34e89c2 Mon Sep 17 00:00:00 2001 From: Pratyush Anand Date: Wed, 14 Sep 2016 20:12:17 +0530 Subject: [PATCH] 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 Reviewed-by: Xunlei Pang Acked-by: Dave Young --- kdumpctl | 3 ++- mkdumprd | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kdumpctl b/kdumpctl index 8617e15..a07a42b 100755 --- a/kdumpctl +++ b/kdumpctl @@ -345,7 +345,8 @@ check_files_modified() EXTRA_BINS="$EXTRA_BINS $CHECK_FILES" CHECK_FILES=`grep ^extra_bins $KDUMP_CONFIG_FILE | cut -d\ -f2-` 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" [ $? -ne 0 ] && return 2 diff --git a/mkdumprd b/mkdumprd index 3705749..12f59a9 100644 --- a/mkdumprd +++ b/mkdumprd @@ -104,7 +104,7 @@ to_mount() { fi _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) # with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd # kernel, filter it out here.