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