5 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
6 . $LUSTRE/tests/test-framework.sh
7 . ${CONFIG:=$LUSTRE/tests/cfg/${NAME}.sh}
9 export PATH=$LUSTRE/utils:$PATH
13 MOUNT=${MOUNT:-/mnt/lustre}
15 MOUNT2=${MOUNT2:-${MOUNT}2}
19 LOG=$TMP/$(basename $0 .sh).log
24 rm -f $OOS $OOS2 $LOG $LOG2
26 sync; sleep 1; sync # to ensure we get up-to-date statfs info
28 STRIPECOUNT=`$LCTL get_param -n lov.*.activeobd | head -n 1`
29 ORIGFREE=`$LCTL get_param -n llite.*.kbytesavail | head -n 1`
30 MAXFREE=${MAXFREE:-$((400000 * $STRIPECOUNT))}
31 echo STRIPECOUNT=$STRIPECOUNT ORIGFREE=$ORIGFREE MAXFREE=$MAXFREE
32 if [ $ORIGFREE -gt $MAXFREE ]; then
33 skip "$0: ${ORIGFREE}kB free gt MAXFREE ${MAXFREE}kB, increase $MAXFREE (or reduce test fs size) to proceed"
37 export LANG=C LC_LANG=C # for "No space left on device" message
39 # make sure we stripe over all OSTs to avoid OOS on only a subset of OSTs
40 $LFS setstripe $OOS -c $STRIPECOUNT
41 $LFS setstripe $OOS2 -c $STRIPECOUNT
42 dd if=/dev/zero of=$OOS count=$((3 * $ORIGFREE / 4 + 100)) bs=1k 2>> $LOG &
44 if dd if=/dev/zero of=$OOS2 count=$((3*$ORIGFREE/4 + 100)) bs=1k 2>> $LOG2; then
45 echo "ERROR: dd2 did not fail"
49 echo "ERROR: dd did not fail"
53 [ ! -s "$LOG" ] && error "LOG file is empty!"
54 [ ! -s "$LOG2" ] && error "LOG2 file is empty!"
56 if [ "`cat $LOG $LOG2 | grep -c 'No space left on device'`" -ne 2 ]; then
57 echo "ERROR: dd not return ENOSPC"
61 # flush cache to OST(s) so avail numbers are correct
65 echo "no OSTs are close to full"
69 RECORDSOUT=$((`grep "records out" $LOG | cut -d+ -f 1` + \
70 `grep "records out" $LOG2 | cut -d+ -f 1`))
72 FILESIZE=$((`ls -l $OOS | awk '{print $5}'` + `ls -l $OOS2 | awk '{print $5}'`))
73 if [ "$RECORDSOUT" -ne $(($FILESIZE / 1024)) ]; then
74 echo "ERROR: blocks written by dd not equal to the size of file"
84 if [ $SUCCESS -eq 1 ]; then