6 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
7 . $LUSTRE/tests/test-framework.sh
8 . ${CONFIG:=$LUSTRE/tests/cfg/${NAME}.sh}
10 export PATH=`dirname $0`/../utils:$PATH
14 MOUNT=${MOUNT:-/mnt/lustre}
17 LOG=$TMP/$(basename $0 .sh).log
23 sync; sleep 1; sync # to ensure we get up-to-date statfs info
25 #$LCTL set_param -n debug=-1
26 #$LCTL set_param -n subsystem_debug=0x40a8
29 #$LCTL debug_daemon start /r/tmp/debug 1024
31 STRIPECOUNT=`$LCTL get_param -n lov.*.activeobd | head -n 1`
32 ORIGFREE=`$LCTL get_param -n llite.*.kbytesavail | head -n 1`
33 MAXFREE=${MAXFREE:-$((400000 * $STRIPECOUNT))}
34 echo STRIPECOUNT=$STRIPECOUNT ORIGFREE=$ORIGFREE MAXFREE=$MAXFREE
35 if [ $ORIGFREE -gt $MAXFREE ]; then
36 skip "$0: ${ORIGFREE}kB free gt MAXFREE ${MAXFREE}kB, increase $MAXFREE (or reduce test fs size) to proceed"
40 export LANG=C LC_LANG=C # for "No space left on device" message
42 [ -f $LOG ] && error "log file wasn't removed?"
44 echo BEFORE dd started
47 # make sure we stripe over all OSTs to avoid OOS on only a subset of OSTs
48 $LFS setstripe $OOS -c $STRIPECOUNT
49 if dd if=/dev/zero of=$OOS count=$(($ORIGFREE + 100)) bs=1k 2> $LOG; then
50 echo "ERROR: dd did not fail"
54 [ ! -s "$LOG" ] && error "LOG file is empty!"
56 if [ "`grep -c 'No space left on device' $LOG`" -ne 1 ]; then
57 echo "ERROR: dd not return ENOSPC"
62 # flush cache to OST(s) so avail numbers are correct
67 echo "no OSTs are close to full"
71 RECORDSOUT=`grep "records out" $LOG | cut -d + -f1`
72 FILESIZE=`ls -l $OOS | awk '{ print $5 }'`
73 if [ -z "$RECORDSOUT" ]; then
74 echo "ERROR: no blocks written by dd?"
77 elif [ "$RECORDSOUT" -ne $((FILESIZE / 1024)) ]; then
78 echo "ERROR: blocks written by dd not equal to the size of file"
82 #$LCTL debug_daemon stop
91 if [ $SUCCESS -eq 1 ]; then