1#!/bin/sh 2 3# Test scenario from: 4# Bug 254210 - jail: nullfs: deleted files does not free up space 5# Fixed by: 1a0cb938f7b4 6 7# Test scenario idea by: ronald@FreeBSD.org 8 9[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 10. ../default.cfg 11 12set -u 13prog=$(basename "$0" .sh) 14log=/tmp/$prog.log 15df -h | grep "$mntpoint" 16mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint 17mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart 18mdconfig -a -t swap -s 2g -u $mdstart 19newfs $newfs_flags -n md$mdstart > /dev/null 20mount /dev/md$mdstart $mntpoint 21 22cd $mntpoint 23mkdir storage test1 test2 24mount_nullfs -o rw,noatime ./storage ./test1 25mount_nullfs -o rw,noatime ./storage ./test2 26 27dd if=/dev/random of=./test1/random.dd bs=1M count=1024 status=none 28 29rm ./test2/random.dd 30df -h | grep "$mntpoint" > $log 31grep -E "${mntpoint}$" $log | grep -q '16K 1.8G 0%' && s=0 || s=1 32if [ $s -eq 1 ]; then 33 echo "Leaking:" 34 cat $log 35 find $mntpoint -type f -ls 36fi 37cd - 38umount $mntpoint/test1 39umount $mntpoint/test2 40umount $mntpoint 41mdconfig -d -u $mdstart 42rm -f rm -f $log 43exit $s 44