diff options
author | kib <kib@FreeBSD.org> | 2014-11-16 23:02:32 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2014-11-16 23:02:32 +0000 |
commit | e01547e9e70b57b8238e62634e4bd6c88ed32cc0 (patch) | |
tree | dc5cde361b78c3c877b05e1653ac200915de5866 /share | |
parent | 7fb42ed981537c54e039f09af4b1cc969a4219ba (diff) | |
download | FreeBSD-src-e01547e9e70b57b8238e62634e4bd6c88ed32cc0.zip FreeBSD-src-e01547e9e70b57b8238e62634e4bd6c88ed32cc0.tar.gz |
MFC r273966:
Fix two issues with lockmgr(9) LK_CAN_SHARE() test, related
to the exclusive locker starvation.
MFC r273986:
Fix the build with ADAPTIVE_LOCKMGRS kernel option.
Diffstat (limited to 'share')
-rw-r--r-- | share/man/man9/lock.9 | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/share/man/man9/lock.9 b/share/man/man9/lock.9 index cb77686..b47ce0e 100644 --- a/share/man/man9/lock.9 +++ b/share/man/man9/lock.9 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 6, 2013 +.Dd November 2, 2014 .Dt LOCK 9 .Os .Sh NAME @@ -145,7 +145,7 @@ Their arguments are: A pointer to the lock to manipulate. .It Fa flags Flags indicating what action is to be taken. -.Bl -tag -width ".Dv LK_CANRECURSE" +.Bl -tag -width ".Dv LK_NODDLKTREAT" .It Dv LK_SHARED Acquire a shared lock. If an exclusive lock is currently held, @@ -199,6 +199,29 @@ Allow recursion on an exclusive lock. For every lock there must be a release. .It Dv LK_INTERLOCK Unlock the interlock (which should be locked already). +.It Dv LK_NODDLKTREAT +Normally, +.Fn lockmgr +postpones serving further shared requests for shared-locked lock if there is +exclusive waiter, to avoid exclusive lock starvation. +But, if the thread requesting the shared lock already owns a shared lockmgr +lock, the request is granted even in presence of the parallel exclusive lock +request, which is done to avoid deadlocks with recursive shared acquisition. +.Pp +The +.Dv LK_NODDLKTREAT +flag can only be used by code which requests shared non-recursive lock. +The flag allows exclusive requests to preempt the current shared request +even if the current thread owns shared locks. +This is safe since shared lock is guaranteed to not recurse, and is used +when thread is known to held unrelated shared locks, to not cause +unneccessary starvation. An example is +.Dv vp +locking in VFS +.Xr lookup 9 , +when +.Dv dvp +is already locked. .El .It Fa ilk An interlock mutex for controlling group access to the lock. |