Whamcloud - gitweb
Make ENOSPC test run as part of sanity.sh so it is tested more often,
authoradilger <adilger>
Fri, 23 Jan 2004 01:27:25 +0000 (01:27 +0000)
committeradilger <adilger>
Fri, 23 Jan 2004 01:27:25 +0000 (01:27 +0000)
but add a safety check to avoid ENOSPC testing on huge filesystems
unless you really want that.  Make oos.sh work on multi-OST filesystems.
b=974

lustre/tests/oos.sh

index 2954472..eca0ee7 100755 (executable)
@@ -3,25 +3,33 @@
 set -e
 set -vx
 
-export NAME=${NAME:-local}
-export OSTSIZE=10000
-
+export PATH=`dirname $0`/../utils:$PATH
+LFS=${LFS:-lfs}
+MOUNT=${MOUNT:-$1}
 MOUNT=${MOUNT:-/mnt/lustre}
 OOS=$MOUNT/oosfile
 LOG=$TMP/oosfile
 TMP=${TMP:-/tmp}
 
-echo "mnt.."
-sh llmount.sh
-echo "done"
-
 SUCCESS=1
 
-ORIGFREE=`df | grep $MOUNT | awk '{ print $4}'`
+rm -f $OOS
+
+STRIPECOUNT=`cat /proc/fs/lustre/lov/*/activeobd | head -1`
+ORIGFREE=`df | grep $MOUNT | awk '{ print $4 }'`
+MAXFREE=${MAXFREE:-$((200000 * $STRIPECOUNT))}
+if [ $ORIGFREE -gt $MAXFREE ]; then
+       echo "skipping out-of-space test on $OSC"
+       echo "reports ${ORIGFREE}kB free, more tham MAXFREE ${MAXFREE}kB"
+       echo "increase $MAXFREE (or reduce test fs size) to proceed"
+       exit 0
+fi
 
 export LANG=C LC_LANG=C # for "No space left on device" message
 
-if dd if=/dev/zero of=$OOS count=$(($ORIGFREE + 16)) bs=1k 2> $LOG; then
+# make sure we stripe over all OSTs to avoid OOS on only a subset of OSTs
+$LFS setstripe $OOS 65536 0 $STRIPECOUNT
+if dd if=/dev/zero of=$OOS count=$(($ORIGFREE + 100)) bs=1k 2> $LOG; then
        echo "ERROR: dd did not fail"
        SUCCESS=0
 fi
@@ -40,7 +48,7 @@ if [ $(($ORIGFREE - $LEFTFREE)) -lt $RECORDSOUT ]; then
        echo "$ORIGFREE - $LEFTFREE $RECORDSOUT"
 fi
 
-if [ $LEFTFREE -gt 100 ]; then
+if [ $LEFTFREE -gt $((100 * $STRIPECOUNT)) ]; then
        echo "ERROR: too much space left $LEFTFREE and -ENOSPC returned"
        SUCCESS=0
 fi
@@ -56,7 +64,4 @@ if [ $SUCCESS -eq 1 ]; then
 
        rm -f $OOS
        rm -f $LOG
-
-       echo -e "\ncln.."
-       sh llmountcleanup.sh
 fi