Whamcloud - gitweb
Add a check in new_fs() to try and avoid overwriting an in-use block device.
authoradilger <adilger>
Fri, 5 Apr 2002 20:13:53 +0000 (20:13 +0000)
committeradilger <adilger>
Fri, 5 Apr 2002 20:13:53 +0000 (20:13 +0000)
Not perfect, because it will only check for mounted filesystems, but better
than nothing.

lustre/tests/common.sh

index edf8e96..478a5ef 100644 (file)
@@ -51,6 +51,11 @@ new_fs () {
                [ $# -lt 2 -o $# -gt 3 ] && \
                        echo "usage: $0 <fstype> <file> [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