5 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
6 . $LUSTRE/tests/test-framework.sh
8 export PATH=$LUSTRE/utils:$PATH
12 MOUNT=${MOUNT:-/mnt/lustre}
14 MOUNT2=${MOUNT2:-${MOUNT}2}
18 LOG=$TMP/$(basename $0 .sh).log
23 rm -f $OOS $OOS2 $LOG $LOG2
25 sync; sleep 1; sync # to ensure we get up-to-date statfs info
27 STRIPECOUNT=`$LCTL get_param -n lov.*.activeobd | head -n 1`
28 ORIGFREE=`$LCTL get_param -n llite.*.kbytesavail | head -n 1`
29 MAXFREE=${MAXFREE:-$((400000 * $STRIPECOUNT))}
30 echo STRIPECOUNT=$STRIPECOUNT ORIGFREE=$ORIGFREE MAXFREE=$MAXFREE
31 if [ $ORIGFREE -gt $MAXFREE ]; then
32 skip "$0: ${ORIGFREE}kB free gt MAXFREE ${MAXFREE}kB, increase $MAXFREE (or reduce test fs size) to proceed"
36 export LANG=C LC_LANG=C # for "No space left on device" message
38 # make sure we stripe over all OSTs to avoid OOS on only a subset of OSTs
39 $LFS setstripe $OOS -c $STRIPECOUNT
40 $LFS setstripe $OOS2 -c $STRIPECOUNT
41 dd if=/dev/zero of=$OOS count=$((3 * $ORIGFREE / 4 + 100)) bs=1k 2>> $LOG &
43 if dd if=/dev/zero of=$OOS2 count=$((3*$ORIGFREE/4 + 100)) bs=1k 2>> $LOG2; then
44 echo "ERROR: dd2 did not fail"
48 echo "ERROR: dd did not fail"
52 [ ! -s "$LOG" ] && error "LOG file is empty!"
53 [ ! -s "$LOG2" ] && error "LOG2 file is empty!"
55 if [ "`cat $LOG $LOG2 | grep -c 'No space left on device'`" -ne 2 ]; then
56 echo "ERROR: dd not return ENOSPC"
60 # flush cache to OST(s) so avail numbers are correct
63 for OSC in `$LCTL get_param -N osc.*-osc-*.kbytesavail | cut -d"." -f1-2`; do
64 AVAIL=`$LCTL get_param -n $OSC.kbytesavail`
65 GRANT=$((`$LCTL get_param -n $OSC.cur_grant_bytes` / 1024))
66 echo -n "$(echo $OSC | cut -d"." -f2) avl=$AVAIL grnt=$GRANT diff=$(($AVAIL - $GRANT))"
67 [ $(($AVAIL - $GRANT)) -lt 400 ] && OSCFULL=full && echo -n " FULL"
71 # FIXME - This test reports false failures
72 # The grants from multiple clients need to be added together and compared
73 # against the kbytesavail.
74 #/proc/fs/lustre/osc/lustre-OST0001-osc-c3b04200/kbytesavail:16248
75 #/proc/fs/lustre/osc/lustre-OST0001-osc-c3b04200/cur_grant_bytes:4313088
76 #/proc/fs/lustre/osc/lustre-OST0001-osc-c3b04e00/cur_grant_bytes:12660736
78 if [ -z "$OSCFULL" ]; then
79 echo "no OSTs are close to full"
80 $LCTL get_param "osc.*-osc-*.kbytesavail"
81 $LCTL get_param "osc.*-osc-*.cur*"
85 RECORDSOUT=$((`grep "records out" $LOG | cut -d+ -f 1` + \
86 `grep "records out" $LOG2 | cut -d+ -f 1`))
88 FILESIZE=$((`ls -l $OOS | awk '{print $5}'` + `ls -l $OOS2 | awk '{print $5}'`))
89 if [ "$RECORDSOUT" -ne $(($FILESIZE / 1024)) ]; then
90 echo "ERROR: blocks written by dd not equal to the size of file"
100 if [ $SUCCESS -eq 1 ]; then