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 sync; sleep 1; sync # 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:-$((400000 * $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 -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 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-*; do
58 AVAIL=`cat $OSC/kbytesavail`
59 GRANT=`cat $OSC/cur_grant_bytes`
60 [ $(($AVAIL - $GRANT / 1024)) -lt 400 ] && OSCFULL=full
63 # FIXME - This test reports false failures
64 # The grants from multiple clients need to be added together and compared
65 # against the kbytesavail.
66 #/proc/fs/lustre/osc/lustre-OST0001-osc-c3b04200/kbytesavail:16248
67 #/proc/fs/lustre/osc/lustre-OST0001-osc-c3b04200/cur_grant_bytes:4313088
68 #/proc/fs/lustre/osc/lustre-OST0001-osc-c3b04e00/cur_grant_bytes:12660736
70 if [ -z "$OSCFULL" ]; then
71 echo "no OSTs are close to full"
72 grep "[0-9]" /proc/fs/lustre/osc/*-osc-*/{kbytesavail,cur*}|tee -a $LOG
76 RECORDSOUT=$((`grep "records out" $LOG | cut -d+ -f 1` + \
77 `grep "records out" $LOG2 | cut -d+ -f 1`))
79 FILESIZE=$((`ls -l $OOS | awk '{print $5}'` + `ls -l $OOS2 | awk '{print $5}'`))
80 if [ "$RECORDSOUT" -ne $(($FILESIZE / 1024)) ]; then
81 echo "ERROR: blocks written by dd not equal to the size of file"
88 if [ $SUCCESS -eq 1 ]; then