POSIX lock resource limit part 3/4
authorJoerg Sonnenberger <joerg@dragonflybsd.org>
Mon, 3 May 2004 16:06:27 +0000 (16:06 +0000)
committerJoerg Sonnenberger <joerg@dragonflybsd.org>
Mon, 3 May 2004 16:06:27 +0000 (16:06 +0000)
commit508ceb095e588d73967ee1886aecb00d07303f4d
treeee47f4086edf3c9a72afda6b07aaeaea9e3fbe9b
parentfc9c7b4f3a2b286f7e743559d6fb4c2d87040bb3
POSIX lock resource limit part 3/4

This splits "struct lockf" into the general book-keeping of ranges and
blocked request and the "struct lockf_range" which constists of the data
for a specific range. Adjust the interface of lf_advlock to remove one
level of pointer indirection and embedded "struct lockf" directly in the
inodes. Don't mess with wait channels any more.

Change the algorithm for determing locks to a more direct approach, which
both simplifies the lock acquisition and proper book-keeping of the number
of ranges currently used. The later is necessary to prevent local resource
exhaustion.

The code is not fully malloc block-safe, but as good or bad as
the old code.

Add the kernel part of the posixlocks rlimit. This is the maximum number of
POSIX lock ranges any user can acquire. These numbers are tracked for each
user and process and checked at lock/unlock time. If a process changes uid,
its locks are transfered to the new uid which can effectivly boost that
number above the limit.

This is based on the patch set from Devon H. O'Dell <dodell@sitetronics.com>
for the general infrastructure with some adjustment to better integrate with
the new lockf code.
18 files changed:
sys/boot/pc98/boot2/inode.h
sys/i386/boot/dosboot/inode.h
sys/kern/kern_lockf.c
sys/kern/kern_mib.c
sys/kern/kern_prot.c
sys/kern/kern_resource.c
sys/kern/subr_param.c
sys/platform/pc32/boot/dosboot/inode.h
sys/sys/fcntl.h
sys/sys/lockf.h
sys/sys/proc.h
sys/sys/resource.h
sys/sys/resourcevar.h
sys/sys/sysctl.h
sys/vfs/isofs/cd9660/cd9660_node.h
sys/vfs/nfs/nfsnode.h
sys/vfs/smbfs/smbfs_node.h
sys/vfs/ufs/inode.h