6 export PATH=`dirname $0`/../utils:$PATH
9 MOUNT=${MOUNT:-/mnt/lustre}
18 sleep 1 # to ensure we get up-to-date statfs info
20 #echo -1 > /proc/sys/portals/debug
21 #echo 0x40a8 > /proc/sys/portals/subsystem_debug
23 #lctl debug_daemon start /r/tmp/debug 1024
25 STRIPECOUNT=`cat /proc/fs/lustre/lov/*/activeobd | head -1`
26 ORIGFREE=`cat /proc/fs/lustre/llite/*/kbytesavail | head -1`
27 MAXFREE=${MAXFREE:-$((200000 * $STRIPECOUNT))}
28 if [ $ORIGFREE -gt $MAXFREE ]; then
29 echo "skipping out-of-space test on $OSC"
30 echo "reports ${ORIGFREE}kB free, more tham MAXFREE ${MAXFREE}kB"
31 echo "increase $MAXFREE (or reduce test fs size) to proceed"
35 export LANG=C LC_LANG=C # for "No space left on device" message
37 # make sure we stripe over all OSTs to avoid OOS on only a subset of OSTs
38 $LFS setstripe $OOS 65536 0 $STRIPECOUNT
39 if dd if=/dev/zero of=$OOS count=$(($ORIGFREE + 100)) bs=1k 2> $LOG; then
40 echo "ERROR: dd did not fail"
44 if [ "`grep -c 'No space left on device' $LOG`" -ne 1 ]; then
45 echo "ERROR: dd not return ENOSPC"
49 # flush cache to OST(s) so avail numbers are correct
52 for OSC in /proc/fs/lustre/osc/OSC*MNT*; do
53 AVAIL=`cat $OSC/kbytesavail`
54 GRANT=`cat $OSC/cur_grant_bytes`
55 [ $(($AVAIL - $GRANT / 1024)) -lt 400 ] && OSCFULL=full
57 if [ -z "$OSCFULL" ]; then
58 echo "no OSTs are close to full"
59 grep [0-9] /proc/fs/lustre/osc/OSC*MNT*/{kbytesavail,cur*}
63 RECORDSOUT=`grep "records out" $LOG | cut -d + -f1`
65 FILESIZE=`ls -l $OOS | awk '{ print $5 }'`
66 if [ $RECORDSOUT -ne $(($FILESIZE / 1024)) ]; then
67 echo "ERROR: blocks written by dd not equal to the size of file"
71 #lctl debug_daemon stop
75 if [ $SUCCESS -eq 1 ]; then