Whamcloud - gitweb
LU-404 bind umount /sbin/mount.lustre only if necessary
authorBobi Jam <bobijam@whamcloud.com>
Thu, 9 Jun 2011 08:50:04 +0000 (16:50 +0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 14 Jun 2011 20:59:13 +0000 (13:59 -0700)
On lustre release installed system, /sbin/mount.lustre will not
bind mount upon $LUSTRE/utils/mount.lustre, so don't need bind
umount it.

Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: I49e671f0acf991a54a01c4f2bb1e82c2db93aa3e
Reviewed-on: http://review.whamcloud.com/918
Reviewed-by: Brian J. Murrell <brian@whamcloud.com>
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/tests/test-framework.sh

index ecf4ef8..14547a1 100644 (file)
@@ -372,9 +372,10 @@ load_modules_local() {
     $LCTL modules > $OGDB/ogdb-$HOSTNAME
 
     # 'mount' doesn't look in $PATH, just sbin
     $LCTL modules > $OGDB/ogdb-$HOSTNAME
 
     # 'mount' doesn't look in $PATH, just sbin
-    local bindmount=$(mount | grep "/sbin/mount.lustre")
-    if [ -f $LUSTRE/utils/mount.lustre ] && [ "x$bindmount" == "x" ]; then
-           mount --bind $LUSTRE/utils/mount.lustre /sbin/mount.lustre || true
+    if [ -f $LUSTRE/utils/mount.lustre ] && \
+       ! grep -qe "/sbin/mount\.lustre " /proc/mounts; then
+        [ ! -f /sbin/mount.lustre ] && touch /sbin/mount.lustre
+        mount --bind $LUSTRE/utils/mount.lustre /sbin/mount.lustre || true
     fi
 }
 
     fi
 }
 
@@ -417,7 +418,11 @@ unload_modules() {
         fi
     fi
 
         fi
     fi
 
-    umount /sbin/mount.lustre
+    if grep -qe "/sbin/mount\.lustre" /proc/mounts; then
+        umount /sbin/mount.lustre || true
+        [ -w /sbin/mount.lustre -a ! -s /sbin/mount.lustre ] && \
+            rm -f /sbin/mount.lustre || true
+    fi
 
     check_mem_leak || return 254
 
 
     check_mem_leak || return 254