When searching for /sbin/mount.lustre in /proc/mounts, use "grep -qw"
instead of using a trailing space, because if the mount.lustre binary
is deleted while it is mounted (e.g. by "make clean") it may have a
non-printable character following it and not be found and unmounted.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: Ia33c4d4b7efa73f543999f73da198fa0698cab07
Reviewed-on: http://review.whamcloud.com/12409
Tested-by: Jenkins
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
local mount_lustre=$LUSTRE/utils/mount.lustre
if [ -f $mount_lustre ]; then
local sbin_mount=/sbin/mount.lustre
- if grep -qe "$sbin_mount " /proc/mounts; then
- cmp $mount_lustre $sbin_mount || umount $sbin_mount
+ if grep -qw "$sbin_mount" /proc/mounts; then
+ cmp -s $mount_lustre $sbin_mount || umount $sbin_mount
fi
- if ! grep -qe "$sbin_mount " /proc/mounts; then
+ if ! grep -qw "$sbin_mount" /proc/mounts; then
[ ! -f "$sbin_mount" ] && touch "$sbin_mount"
if [ ! -s "$sbin_mount" -a -w "$sbin_mount" ]; then
cat <<- EOF > "$sbin_mount"