6 export PATH=`dirname $0`/../utils:$PATH
9 MOUNT=${MOUNT:-/mnt/lustre}
11 MOUNT2=${MOUNT2:-${MOUNT}2}
20 rm -f $OOS $OOS2 $LOG $LOG2
22 sleep 1 # to ensure we get up-to-date statfs info
24 STRIPECOUNT=`cat /proc/fs/lustre/lov/*/activeobd | head -1`
25 ORIGFREE=`cat /proc/fs/lustre/llite/*/kbytesavail | head -1`
26 MAXFREE=${MAXFREE:-$((200000 * $STRIPECOUNT))}
27 if [ $ORIGFREE -gt $MAXFREE ]; then
28 echo "skipping out-of-space test on $OSC"
29 echo "reports ${ORIGFREE}kB free, more tham MAXFREE ${MAXFREE}kB"
30 echo "increase $MAXFREE (or reduce test fs size) to proceed"
34 export LANG=C LC_LANG=C # for "No space left on device" message
36 # make sure we stripe over all OSTs to avoid OOS on only a subset of OSTs
37 $LFS setstripe $OOS 65536 -1 $STRIPECOUNT
38 $LFS setstripe $OOS2 65536 -1 $STRIPECOUNT
39 dd if=/dev/zero of=$OOS count=$((3 * $ORIGFREE / 4 + 100)) bs=1k 2>> $LOG &
41 if dd if=/dev/zero of=$OOS2 count=$((3*$ORIGFREE/4 + 100)) bs=1k 2>> $LOG2; then
42 echo "ERROR: dd2 did not fail"
46 echo "ERROR: dd did not fail"
50 if [ "`cat $LOG $LOG2 | grep -c 'No space left on device'`" -ne 2 ]; then
51 echo "ERROR: dd not return ENOSPC"
55 # flush cache to OST(s) so avail numbers are correct
58 for AVAIL in /proc/fs/lustre/osc/OSC*MNT*/kbytesavail; do
59 [ `cat $AVAIL` -lt 400 ] && OSCFULL=full
61 if [ -z "$OSCFULL" ]; then
62 echo "no OSTs are close to full"
63 grep "[0-9]" /proc/fs/lustre/osc/OSC*MNT*/{kbytesavail,cur*} |tee -a $LOG
67 RECORDSOUT=$((`grep "records out" $LOG | cut -d+ -f 1` + \
68 `grep "records out" $LOG2 | cut -d+ -f 1`))
70 FILESIZE=$((`ls -l $OOS | awk '{print $5}'` + `ls -l $OOS2 | awk '{print $5}'`))
71 if [ $RECORDSOUT -ne $(($FILESIZE / 1024)) ]; then
72 echo "ERROR: blocks written by dd not equal to the size of file"
78 if [ $SUCCESS -eq 1 ]; then