From 6cce4eb9e85267c656e3defe775689c4202fa2f3 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Fri, 17 Jan 2014 22:30:16 -0700 Subject: [PATCH] LU-1538 tests: unmount /sbin/mount.lustre bind mount If the lustre/utils/mount.lustre file has changed since it was bind mounted on /sbin/mount.lustre, unmount it and mount the new one there, to avoid strange problems when testing from a local tree Signed-off-by: Andreas Dilger Change-Id: Ie5360dae9f33553acb914c8ce549e848c1500c1e Reviewed-on: http://review.whamcloud.com/8912 Tested-by: Jenkins Reviewed-by: Nathaniel Clark Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- lustre/tests/test-framework.sh | 57 ++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 8089b1e..9b1b47e 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -531,20 +531,25 @@ load_modules_local() { load_module osp/osp fi - - load_module llite/lustre - llite_lloop_enabled && load_module llite/llite_lloop - [ -d /r ] && OGDB=${OGDB:-"/r/tmp"} - OGDB=${OGDB:-$TMP} - rm -f $OGDB/ogdb-$HOSTNAME - $LCTL modules > $OGDB/ogdb-$HOSTNAME - - # 'mount' doesn't look in $PATH, just sbin - 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 + load_module llite/lustre + llite_lloop_enabled && load_module llite/llite_lloop + [ -d /r ] && OGDB=${OGDB:-"/r/tmp"} + OGDB=${OGDB:-$TMP} + rm -f $OGDB/ogdb-$HOSTNAME + $LCTL modules > $OGDB/ogdb-$HOSTNAME + + # 'mount' doesn't look in $PATH, just sbin + local MOUNT_LUSTRE=$LUSTRE/utils/mount.lustre + if [ -f $MOUNT_LUSTRE ]; then + if grep -qe "/sbin/mount\.lustre " /proc/mounts; then + cmp $MOUNT_LUSTRE /sbin/mount.lustre || + umount /sbin/mount.lustre + fi + if ! grep -qe "/sbin/mount\.lustre " /proc/mounts; then + [ ! -f /sbin/mount.lustre ] && touch /sbin/mount.lustre + mount --bind $MOUNT_LUSTRE /sbin/mount.lustre + fi + fi } load_modules () { @@ -4070,18 +4075,22 @@ check_and_cleanup_lustre() { [ "$ENABLE_QUOTA" ] && restore_quota || true fi - if [ "$I_UMOUNTED2" = "yes" ]; then - restore_mount $MOUNT2 || error "restore $MOUNT2 failed" - fi + if [ "$I_UMOUNTED2" = "yes" ]; then + restore_mount $MOUNT2 || error "restore $MOUNT2 failed" + fi - if [ "$I_MOUNTED2" = "yes" ]; then - cleanup_mount $MOUNT2 - fi + if [ "$I_MOUNTED2" = "yes" ]; then + cleanup_mount $MOUNT2 + fi - if [ "$I_MOUNTED" = "yes" ]; then - cleanupall -f || error "cleanup failed" - unset I_MOUNTED - fi + if [ "$I_MOUNTED" = "yes" ]; then + cleanupall -f || error "cleanup failed" + unset I_MOUNTED + fi + + if grep -qe "/sbin/mount\.lustre " /proc/mounts; then + umount /sbin/mount.lustre + fi } ####### -- 1.8.3.1