Whamcloud - gitweb
LU-5499 tests: use grep -w to search /proc/mounts 09/12409/4
authorAndreas Dilger <andreas.dilger@intel.com>
Fri, 24 Oct 2014 00:42:45 +0000 (18:42 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 27 Jan 2015 03:19:13 +0000 (03:19 +0000)
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>
lustre/tests/test-framework.sh

index 96d86bc..d9af277 100755 (executable)
@@ -543,10 +543,10 @@ load_modules_local() {
        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"