From 49fa9f2cee3e1ab39fc3ab2eb8363ad2447decce Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 5 Apr 2002 20:13:53 +0000 Subject: [PATCH] Add a check in new_fs() to try and avoid overwriting an in-use block device. Not perfect, because it will only check for mounted filesystems, but better than nothing. --- lustre/tests/common.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lustre/tests/common.sh b/lustre/tests/common.sh index edf8e96..478a5ef 100644 --- a/lustre/tests/common.sh +++ b/lustre/tests/common.sh @@ -51,6 +51,11 @@ new_fs () { [ $# -lt 2 -o $# -gt 3 ] && \ echo "usage: $0 [size]" 1>&2 && exit -1 + PM="/proc/mounts" + [ -f "$PM" ] || PM="/etc/mtab" + + grep "$2 " $PM 1>&2 && echo "$0: $2 is in $PM!" 1>&2 && exit -1 + $MKFS $MKFSOPT $2 $3 || exit -1 LOOPDEV=$2 # Not really a loop device else -- 1.8.3.1