summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_lockf.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Replace rwsleep(9) with rwsleep_nsec(9) in vfs_lockf.c.visa2019-12-021-3/+4
| | | | | Prompted by and OK cheloha@ OK mpi@ anton@
* Remove now unneeded kernel locking from vfs_lockf.c.visa2019-12-021-7/+2
| | | | OK mpi@ anton@
* no need to store the wmesg passed to rwsleep() as a static variable anymoreanton2019-05-121-3/+2
|
* Restore previous behavior of limiting deadlock detection to posix-styleanton2019-05-111-7/+8
| | | | | | | | locks. ok jturner@ visa@ Reported-by: syzbot+f9f13034fd656af6c48f@syzkaller.appspotmail.com
* group function prototypesanton2019-05-081-4/+3
|
* Bring back lockf deadlock detection from the dead. Back in 2007, the deadlockanton2019-05-061-53/+55
| | | | | | | | | | | | | detection broke while changing the owner of a lock from struct proc to struct filedesc/file. Instead of keeping track of the owning proc for each lock, introduce a new list for all pending blocked locks. This list is scanned before waiting on a blocking lock in order to determine if sleeping would cause a deadlock. The new implementation is serialized by the recently added locking to the same subsystem, meaning that acquiring the kernel lock is no longer necessary. ok visa@
* print locked range in decimal in debug routinesanton2019-04-201-2/+2
|
* Move lockf structures from header to implementation since external usersanton2019-04-201-2/+32
| | | | | | only need a lockf_state pointer by now. ok mpi@ visa@
* Add a subsystem lock for vfs_lockf.c. This enables calling lf_advlock()visa2019-04-191-34/+76
| | | | | | and lf_purgelocks() without the kernel lock. OK anton@ mpi@
* Move the prototypes of internal lockf functions from <sys/lockf.h>visa2019-03-311-1/+11
| | | | | | | | | to vfs_lockf.c. This makes the public interface clearer. The declaration of variable lockf_debug is removed from the header because it is not needed outside of vfs_lockf.c. OK anton@ tedu@
* always include the lock id address in debug outputanton2019-02-241-7/+4
|
* initialize struct lockf fields in a consistent order; ok millert@ mpi@ visa@anton2019-02-241-4/+4
|
* Replace hand rolled linked list with TAILQ. All made possible by the recentanton2019-01-301-133/+75
| | | | | | introduction of struct lockf_state. ok bluhm@ visa@
* Introduce a dedicated entry point data structure for file locks. This new dataanton2019-01-211-36/+126
| | | | | | | | | | | | structure allows for better tracking of pending lock operations which is essential in order to prevent a use-after-free once the underlying vnode is gone. Inspired by the lockf implementation in FreeBSD. ok visa@ Reported-by: syzbot+d5540a236382f50f1dac@syzkaller.appspotmail.com
* use the LFPRINTF() debug macro consistently; ok mpi@anton2018-11-101-38/+11
|
* Conform to POSIX-2001 in which the behavior of passing a negative length usinganton2018-11-101-6/+11
| | | | | | | posix file locks is defined. Also, detect overflows when dealing with positive lengths. ok millert@ visa@
* make debug flags continuousanton2018-11-021-2/+2
|
* Add assertions for lockf list manipulation, hidden behind LOCKF_DIAGNOSTIC.anton2018-10-271-15/+61
| | | | | | | While here, improve existing lockf debug routines and sprinkle some more logging related to list manipulation. ok deraadt@ visa@ (as part of a larger diff)
* Rework previous lockf fix; bluhm@ noticed a regress failure during consecutiveanton2018-10-271-43/+73
| | | | | | | | runs. This is a second attempt in which the lockf structure is turned into a doubly linked list which makes it easier to ensure correctness during list insertion and deletion. ok deraadt@ visa@
* When freeing a lockf struct that already is part of a linked list, make sure toanton2018-10-061-2/+9
| | | | | | update the next pointer for the preceding lock. Prevents a double free panic. ok millert@
* Serialize access to UID data with a rwlock.mpi2018-02-261-2/+6
| | | | | | | Caller must call uid_release() after making whatever change they needed on the result of uid_find(). Adapted from guenther@'s proctree diff, ok dlg@, visa@
* Split PID from TID, giving processes a PID unrelated to the TID of theirguenther2016-11-071-3/+3
| | | | | | initial thread ok jsing@ kettenis@
* all pools have their ipl set via pool_setipl, so fold it into pool_init.dlg2016-09-151-3/+2
| | | | | | | | | | | | | | | | | | | | | | the ioff argument to pool_init() is unused and has been for many years, so this replaces it with an ipl argument. because the ipl will be set on init we no longer need pool_setipl. most of these changes have been done with coccinelle using the spatch below. cocci sucks at formatting code though, so i fixed that by hand. the manpage and subr_pool.c bits i did myself. ok tedu@ jmatthew@ @ipl@ expression pp; expression ipl; expression s, a, o, f, m, p; @@ -pool_init(pp, s, a, o, f, m, p); -pool_setipl(pp, ipl); +pool_init(pp, s, a, ipl, f, m, p);
* pool_setipldlg2016-08-251-1/+2
| | | | ok kettenis@
* spliting -> splittingmmcc2015-12-221-2/+2
|
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* start retiring the nointr allocator. specify PR_WAITOK as a flag as atedu2014-12-191-3/+3
| | | | marker for which pools are not interrupt safe. ok dlg
* include sys/unistd.h where needed instead of indirect reliance. ok jsgtedu2014-11-031-1/+2
|
* POSIX locks should track the process's pid and not the thread's idguenther2012-04-101-2/+2
|
* correct some minor style violationstedu2010-06-291-60/+11
|
* only apply the strict limit on F_SETLK; ok deraadt@ fgsch@otto2009-03-241-2/+2
|
* advisory locks should return ENOLCK if we're out of locks.otto2009-03-231-2/+2
| | | | ok deraadt@ fgs@
* Fix a bunch of problems and races with posix file locking.art2008-09-191-5/+3
| | | | | | | | | | | | | | | | - file descriptor table becomes the owner of the lock instead of the proc. - When grabbing the lock, we check if the fd hasn't changed under our feet, this is more or less impossible to solve without a hack like this. I've banged my head against the wall, I figured out a solution, but implementing it correctly would cost me 12 gray hairs. Screw it, this is ugly, but it works. - Wait until usecount drains before releasing the posix lock in closef. - Add missing FREF/FRELE to sys_flock - keep the pid in the flock struct instead of abusing the fact that we used to use the proc as the lock owner. Pointed out by and discussed with Al Viro, big thanks. miod@ ok
* Use ANSI function declarations and deregister, no binary changepedro2005-11-201-42/+21
|
* revise lockf limit policy. after exceeding "soft limit", start enforcingtedu2005-03-151-3/+14
| | | | a hard limit of 2x. add a comment to this effect. reviewed by miod
* split out uidinfo from kern_proc.c private, use it to store lock count,tedu2005-03-101-15/+53
| | | | | | restrict lock count per uid to a global limit, add sysctl to adjust limit. this prevents a user from creating too many locks. problem noticed by devon o'dell. ok deraadt miod pedro
* useless caddr_t cast removal. same md5s.tedu2004-04-131-2/+2
|
* Get rid of M_LOCKF and use pool for allocating lockf structures.grange2004-01-141-16/+25
| | | | | | From NetBSD. Tested by many people, ok art@.
* remove caddr_t casts. it's just silly to cast something when the functiontedu2003-07-211-3/+3
| | | | takes a void *. convert uiomove to take a void * as well. ok deraadt@
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-6/+2
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* use %ll instead of %qderaadt2001-09-051-3/+3
|
* Check for negative lock length.gluk2001-07-281-11/+15
| | | | costa@ ok.
* Fix PR1826. tsleep in lf_setlock can return 0 if process was ptrace'd,gluk2001-06-201-177/+125
| | | | | | | | | | | | | | | | | | | | | but not wakeup'ed. In this case one entry can be placed twice at list of blocked locks. As a result block list contain an entry which points to itself. lf_wakelock can't remove such an entry and system livelocks trying to remove a bad entry from block list. Other changes include: - repair debug functions and make vfs_lockf.c compilable with LOCKF_DEBUG - simplify debug printing and remove useless debugging - remove unnecessary casting, replace NOLOCKF with NULL - free -> FREE (use one form over the file) - convert list of blocked locks to use TAILQ_* macroses - lf_addblock() -> TAILQ_INSERT_TAIL - Fix bug in lf_findoverlap(): in old code if (end == -1) && (lf->lf_end == -1) && (lf->lf_start <= start) then lf_findoverlap() return 4 instead of 2 - work more carefully with pointers (probably fix one or two bugs) - use wakeup_one() - KNF
* From NetBSD: 960217 mergeniklas1996-03-031-7/+12
|
* initial import of NetBSD treederaadt1995-10-181-0/+794