LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
. $LUSTRE/tests/test-framework.sh
+. ${CONFIG:=$LUSTRE/tests/cfg/${NAME}.sh}
export PATH=`dirname $0`/../utils:$PATH
LFS=${LFS:-lfs}
[ -f $LOG ] && error "log file wasn't removed?"
echo BEFORE dd started
-for OSC in `$LCTL get_param -N osc.*-osc-*.kbytesavail | cut -d"." -f1-2`; do
- AVAIL=`$LCTL get_param -n $OSC.kbytesavail`
- GRANT=$((`$LCTL get_param -n $OSC.cur_grant_bytes` / 1024))
- echo -n "$(echo $OSC | cut -d"." -f2) avl=$AVAIL grnt=$GRANT diff=$(($AVAIL - $GRANT))"
- echo " "
-done
+oos_full || true
# make sure we stripe over all OSTs to avoid OOS on only a subset of OSTs
$LFS setstripe $OOS -c $STRIPECOUNT
-if dd if=/dev/zero of=$OOS count=$(($ORIGFREE + 100)) bs=1k 2> $LOG; then
+# add 20% of margin since the metadata overhead estimated in bavail might be
+# too aggressive and we might be able to write more than reported initially
+# by statfs.
+echo dd size $((ORIGFREE * 120 / 100))kB
+if dd if=/dev/zero of=$OOS count=$((ORIGFREE * 120 / 100)) bs=1k 2> $LOG; then
echo "ERROR: dd did not fail"
SUCCESS=0
fi
sync; sleep 1 ; sync
echo AFTER dd
-for OSC in `$LCTL get_param -N osc.*-osc-*.kbytesavail | cut -d"." -f1-2`; do
- AVAIL=`$LCTL get_param -n $OSC.kbytesavail`
- GRANT=$((`$LCTL get_param -n $OSC.cur_grant_bytes` / 1024))
- echo -n "$(echo $OSC | cut -d"." -f2) avl=$AVAIL grnt=$GRANT diff=$(($AVAIL - $GRANT))"
- [ $(($AVAIL - $GRANT)) -lt 400 ] && OSCFULL=full && echo -n " FULL"
- echo " "
-done
-
-if [ -z "$OSCFULL" ]; then
+if ! oos_full; then
echo "no OSTs are close to full"
- $LCTL get_param "osc.*-osc-*.kbytesavail"
- $LCTL get_param "osc.*-osc-*.cur*"
SUCCESS=0
fi
#$LCTL debug_daemon stop
-echo LOG file
-cat $LOG
+[ $SUCCESS != 0 ] && echo LOG file && sed "s/^/LOG: /" $LOG
rm -f $OOS
-sync; sleep 1; sync
+
+sync; sleep 3; sync
wait_delete_completed 300
LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
. $LUSTRE/tests/test-framework.sh
+. ${CONFIG:=$LUSTRE/tests/cfg/${NAME}.sh}
export PATH=$LUSTRE/utils:$PATH
LFS=${LFS:-lfs}
# flush cache to OST(s) so avail numbers are correct
sync; sleep 1 ; sync
-for OSC in `$LCTL get_param -N osc.*-osc-*.kbytesavail | cut -d"." -f1-2`; do
- AVAIL=`$LCTL get_param -n $OSC.kbytesavail`
- GRANT=$((`$LCTL get_param -n $OSC.cur_grant_bytes` / 1024))
- echo -n "$(echo $OSC | cut -d"." -f2) avl=$AVAIL grnt=$GRANT diff=$(($AVAIL - $GRANT))"
- [ $(($AVAIL - $GRANT)) -lt 400 ] && OSCFULL=full && echo -n " FULL"
- echo " "
-done
-
-# FIXME - This test reports false failures
-# The grants from multiple clients need to be added together and compared
-# against the kbytesavail.
-#/proc/fs/lustre/osc/lustre-OST0001-osc-c3b04200/kbytesavail:16248
-#/proc/fs/lustre/osc/lustre-OST0001-osc-c3b04200/cur_grant_bytes:4313088
-#/proc/fs/lustre/osc/lustre-OST0001-osc-c3b04e00/cur_grant_bytes:12660736
-
-if [ -z "$OSCFULL" ]; then
+if ! oos_full; then
echo "no OSTs are close to full"
- $LCTL get_param "osc.*-osc-*.kbytesavail"
- $LCTL get_param "osc.*-osc-*.cur*"
SUCCESS=0
fi
*) EXT=".ko"; USE_QUOTA=yes;;
esac
+oos_full() {
+ local -a AVAILA
+ local -a GRANTA
+ local -a TOTALA
+ local OSCFULL=1
+ AVAILA=($(do_nodes $(comma_list $(osts_nodes)) \
+ $LCTL get_param obdfilter.*.kbytesavail))
+ GRANTA=($(do_nodes $(comma_list $(osts_nodes)) \
+ $LCTL get_param -n obdfilter.*.tot_granted))
+ TOTALA=($(do_nodes $(comma_list $(osts_nodes)) \
+ $LCTL get_param -n obdfilter.*.kbytestotal))
+ for ((i=0; i<${#AVAILA[@]}; i++)); do
+ local -a AVAIL1=(${AVAILA[$i]//=/ })
+ local -a TOTAL=(${TOTALA[$i]//=/ })
+ GRANT=$((${GRANTA[$i]}/1024))
+ # allow 1% of total space in bavail because of delayed
+ # allocation with ZFS which might release some free space after
+ # txg commit. For small devices, we set a mininum of 8MB
+ local LIMIT=$((${TOTAL} / 100 + 8000))
+ echo -n $(echo ${AVAIL1[0]} | cut -d"." -f2) avl=${AVAIL1[1]} \
+ grnt=$GRANT diff=$((AVAIL1[1] - GRANT)) limit=${LIMIT}
+ [ $((AVAIL1[1] - GRANT)) -lt $LIMIT ] && OSCFULL=0 && \
+ echo " FULL" || echo
+ done
+ return $OSCFULL
+}
+
pool_list () {
do_facet mgs lctl pool_list $1
}
local changes
# find MDS with pending deletions
- for node in $(mdts_nodes); do
+ for node in $(facet_host mds); do
changes=$(do_node $node "lctl get_param -n osc.*MDT*.sync_*" \
2>/dev/null | calc_sum)
if [ -z "$changes" ] || [ $changes -eq 0 ]; then