X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Ftests%2Ftest-framework.sh;h=db1990e1578a79f0cd8582e3c14eabe5443c03d5;hp=f38f0881bffed171c44fc6210e03fa85a1645d37;hb=f042378fd661bde51f32de2fd400f6afb784f6b9;hpb=ed5ebb87bfc2b684958daac90c4369f395482a16 diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index f38f088..db1990e 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -539,15 +539,27 @@ load_modules_local() { $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 + 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 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 + if ! grep -qe "$sbin_mount " /proc/mounts; then + [ ! -f "$sbin_mount" ] && touch "$sbin_mount" + if [ ! -s "$sbin_mount" -a -w "$sbin_mount" ]; then + cat <<- EOF > "$sbin_mount" + #!/bin/sh + #STUB MARK + echo "This $sbin_mount just a mountpoint." 1>&2 + echo "It is never supposed to be run." 1>&2 + logger -p emerg -- "using stub $sbin_mount $@" + exit 1 + EOF + chmod a+x $sbin_mount + fi + mount --bind $mount_lustre $sbin_mount || + error "can't bind $mount_lustre to $sbin_mount" fi fi } @@ -593,16 +605,17 @@ unload_modules() { fi fi - 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 + local sbin_mount=/sbin/mount.lustre + if grep -qe "$sbin_mount " /proc/mounts; then + umount $sbin_mount || true + [ -s $sbin_mount ] && ! grep -q "STUB MARK" $sbin_mount || + rm -f $sbin_mount + fi - check_mem_leak || return 254 + check_mem_leak || return 254 - echo "modules unloaded." - return 0 + echo "modules unloaded." + return 0 } fs_log_size() { @@ -4118,10 +4131,6 @@ check_and_cleanup_lustre() { cleanupall -f || error "cleanup failed" unset I_MOUNTED fi - - if grep -qe "/sbin/mount\.lustre " /proc/mounts; then - umount /sbin/mount.lustre - fi } #######