5 export PATH=`dirname $0`/../utils:$PATH
8 MOUNT=${MOUNT:-/mnt/lustre}
10 MOUNT2=${MOUNT2:-${MOUNT}2}
19 rm -f $OOS $OOS2 $LOG $LOG2
21 sleep 1 # to ensure we get up-to-date statfs info
23 STRIPECOUNT=`cat /proc/fs/lustre/lov/*/activeobd | head -n 1`
24 ORIGFREE=`cat /proc/fs/lustre/llite/*/kbytesavail | head -n 1`
25 MAXFREE=${MAXFREE:-$((200000 * $STRIPECOUNT))}
26 if [ $ORIGFREE -gt $MAXFREE ]; then
27 echo "skipping out-of-space test on $OSC"
28 echo "reports ${ORIGFREE}kB free, more tham MAXFREE ${MAXFREE}kB"
29 echo "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 65536 -1 $STRIPECOUNT
37 $LFS setstripe $OOS2 65536 -1 $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 if [ "`cat $LOG $LOG2 | grep -c 'No space left on device'`" -ne 2 ]; then
50 echo "ERROR: dd not return ENOSPC"
54 # flush cache to OST(s) so avail numbers are correct
57 for OSC in /proc/fs/lustre/osc/OSC*MNT*; do
58 AVAIL=`cat $OSC/kbytesavail`
59 GRANT=`cat $OSC/cur_grant_bytes`
60 [ $(($AVAIL - $GRANT / 1024)) -lt 400 ] && OSCFULL=full
62 if [ -z "$OSCFULL" ]; then
63 echo "no OSTs are close to full"
64 grep [0-9] /proc/fs/lustre/osc/OSC*MNT*/{kbytesavail,cur*} |tee -a $LOG
68 RECORDSOUT=$((`grep "records out" $LOG | cut -d+ -f 1` + \
69 `grep "records out" $LOG2 | cut -d+ -f 1`))
71 FILESIZE=$((`ls -l $OOS | awk '{print $5}'` + `ls -l $OOS2 | awk '{print $5}'`))
72 if [ $RECORDSOUT -ne $(($FILESIZE / 1024)) ]; then
73 echo "ERROR: blocks written by dd not equal to the size of file"
79 if [ $SUCCESS -eq 1 ]; then