# 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
#$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
+
if [ $SUCCESS -eq 1 ]; then
echo "Success!"
rm -f $LOG