misc/80799: vnode disks don't play well with setrlimit

Mark Blackman mark at exonetric.com
Sun May 8 14:00:24 PDT 2005

>Number:         80799
>Category:       misc
>Synopsis:       vnode disks don't play well with setrlimit
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 08 21:00:23 GMT 2005
>Originator:     Mark Blackman
>Release:        4.11-STABLe
FreeBSD varadero.exonetric.net 4.11-STABLE FreeBSD 4.11-STABLE #2: Sat Apr 23 22:20:21 BST 2005     root at varadero.exonetric.net:/usr/obj/usr/src/sys/MAIN-NOSMP  i386

Using the setrlimit call to limit maximum filesize (or other resource) on 
vnode-based (vn(4)) filesystem seems to 
leads to more restriction than the setrlimit call required. For instance
setting a 1M byte filesize limit can lead to file too large errors even for
a zero sized file.

There also appears to be some relationship between the size of
the vnode file image that provides the backing and the setrlimit
value which allows you to create a zero-sized file.
varadero# cd /dev
varadero# sh MAKEDEV vn0
varadero# touch /tmp/testimage
varadero# vnconfig -e -s labels -S 100m -Z vn0 /tmp/testimage
varadero# disklabel -r -w vn0 auto
varadero# newfs /dev/vn0c
Warning: Block size restricts cylinders per group to 97.
/dev/vn0c:      204800 sectors in 50 cylinders of 1 tracks, 4096 sectors
        100.0MB in 1 cyl groups (97 c/g, 194.00MB/g, 12800 i/g)
super-block backups (for fsck -b #) at:
varadero# mount /dev/vn0c /mnt
varadero# limits -f 1024k touch /mnt/t1
zsh: file size limit exceeded  limits -f 1024k touch /mnt/t1
varadero# limits -f 4096k touch /mnt/t1
varadero# ls -ld /mnt/t1
-rw-r--r--  1 root  wheel  0 May  8 21:42 /mnt/t1

no known fix, just use a very large setrlimit value (or infinity) if having 
trouble creating files.

More information about the freebsd-bugs mailing list