1e5e600c9SMark Murray.\" 25385e8bfSChad David.\" Copyright (C) 2002 Chad David <davidc@acns.ab.ca>. All rights reserved. 3e5e600c9SMark Murray.\" 4e5e600c9SMark Murray.\" Redistribution and use in source and binary forms, with or without 5e5e600c9SMark Murray.\" modification, are permitted provided that the following conditions 6e5e600c9SMark Murray.\" are met: 7e5e600c9SMark Murray.\" 1. Redistributions of source code must retain the above copyright 85385e8bfSChad David.\" notice(s), this list of conditions and the following disclaimer as 95385e8bfSChad David.\" the first lines of this file unmodified other than the possible 105385e8bfSChad David.\" addition of one or more copyright notices. 11e5e600c9SMark Murray.\" 2. Redistributions in binary form must reproduce the above copyright 125385e8bfSChad David.\" notice(s), this list of conditions and the following disclaimer in the 13e5e600c9SMark Murray.\" documentation and/or other materials provided with the distribution. 14e5e600c9SMark Murray.\" 155385e8bfSChad David.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 165385e8bfSChad David.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 175385e8bfSChad David.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 185385e8bfSChad David.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 195385e8bfSChad David.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 205385e8bfSChad David.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 215385e8bfSChad David.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 225385e8bfSChad David.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 235385e8bfSChad David.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 245385e8bfSChad David.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 255385e8bfSChad David.\" DAMAGE. 26e5e600c9SMark Murray.\" 27e5e600c9SMark Murray.\" $FreeBSD$ 28e5e600c9SMark Murray.\" 29*72ba3c08SKonstantin Belousov.Dd November 2, 2014 30e5e600c9SMark Murray.Dt LOCK 9 313d45e180SRuslan Ermilov.Os 32e5e600c9SMark Murray.Sh NAME 33e5e600c9SMark Murray.Nm lockinit , 345385e8bfSChad David.Nm lockdestroy , 355385e8bfSChad David.Nm lockmgr , 367f527abcSAttilio Rao.Nm lockmgr_args , 3748a12f89SAttilio Rao.Nm lockmgr_args_rw , 38fc2d483eSAttilio Rao.Nm lockmgr_disown , 39fa885265SAttilio Rao.Nm lockmgr_printinfo , 40f0c5fe2dSAttilio Rao.Nm lockmgr_recursed , 4148a12f89SAttilio Rao.Nm lockmgr_rw , 42b4b811faSChristian Brueffer.Nm lockmgr_waiters , 4378a25172SAttilio Rao.Nm lockstatus , 44f0c5fe2dSAttilio Rao.Nm lockmgr_assert 455385e8bfSChad David.Nd "lockmgr family of functions" 46e5e600c9SMark Murray.Sh SYNOPSIS 4732eef9aeSRuslan Ermilov.In sys/types.h 48008f392eSAttilio Rao.In sys/lock.h 495385e8bfSChad David.In sys/lockmgr.h 50e5e600c9SMark Murray.Ft void 51c4a7ba6eSChad David.Fn lockinit "struct lock *lkp" "int prio" "const char *wmesg" "int timo" "int flags" 525385e8bfSChad David.Ft void 535385e8bfSChad David.Fn lockdestroy "struct lock *lkp" 54e5e600c9SMark Murray.Ft int 5548a12f89SAttilio Rao.Fn lockmgr "struct lock *lkp" "u_int flags" "struct mtx *ilk" 565385e8bfSChad David.Ft int 5748a12f89SAttilio Rao.Fn lockmgr_args "struct lock *lkp" "u_int flags" "struct mtx *ilk" "const char *wmesg" "int prio" "int timo" 5848a12f89SAttilio Rao.Ft int 5948a12f89SAttilio Rao.Fn lockmgr_args_rw "struct lock *lkp" "u_int flags" "struct rwlock *ilk" "const char *wmesg" "int prio" "int timo" 605385e8bfSChad David.Ft void 61fc2d483eSAttilio Rao.Fn lockmgr_disown "struct lock *lkp" 62fc2d483eSAttilio Rao.Ft void 63d576deedSPawel Jakub Dawidek.Fn lockmgr_printinfo "const struct lock *lkp" 64fa885265SAttilio Rao.Ft int 65d576deedSPawel Jakub Dawidek.Fn lockmgr_recursed "const struct lock *lkp" 667f527abcSAttilio Rao.Ft int 6748a12f89SAttilio Rao.Fn lockmgr_rw "struct lock *lkp" "u_int flags" "struct rwlock *ilk" 6848a12f89SAttilio Rao.Ft int 69d576deedSPawel Jakub Dawidek.Fn lockmgr_waiters "const struct lock *lkp" 70b4b811faSChristian Brueffer.Ft int 71d576deedSPawel Jakub Dawidek.Fn lockstatus "const struct lock *lkp" 72f0c5fe2dSAttilio Rao.Pp 73f0c5fe2dSAttilio Rao.Cd "options INVARIANTS" 74f0c5fe2dSAttilio Rao.Cd "options INVARIANT_SUPPORT" 75f0c5fe2dSAttilio Rao.Ft void 76d576deedSPawel Jakub Dawidek.Fn lockmgr_assert "const struct lock *lkp" "int what" 77e5e600c9SMark Murray.Sh DESCRIPTION 785385e8bfSChad DavidThe 79e5e600c9SMark Murray.Fn lockinit 805385e8bfSChad Davidfunction is used to initialize a lock. 81ffa23792SChad DavidIt must be called before any operation can be performed on a lock. 825385e8bfSChad DavidIts arguments are: 835385e8bfSChad David.Bl -tag -width ".Fa wmesg" 845385e8bfSChad David.It Fa lkp 855385e8bfSChad DavidA pointer to the lock to initialize. 865385e8bfSChad David.It Fa prio 875385e8bfSChad DavidThe priority passed to 88e7573e7aSJohn Baldwin.Xr sleep 9 . 895385e8bfSChad David.It Fa wmesg 905385e8bfSChad DavidThe lock message. 915385e8bfSChad DavidThis is used for both debugging output and 92e7573e7aSJohn Baldwin.Xr sleep 9 . 935385e8bfSChad David.It Fa timo 945385e8bfSChad DavidThe timeout value passed to 95e7573e7aSJohn Baldwin.Xr sleep 9 . 965385e8bfSChad David.It Fa flags 97008f392eSAttilio RaoThe flags the lock is to be initialized with: 98abd94b3dSAttilio Rao.Bl -tag -width ".Dv LK_CANRECURSE" 99651175c9SAttilio Rao.It Dv LK_ADAPTIVE 100651175c9SAttilio RaoEnable adaptive spinning for this lock if the kernel is compiled with the 101651175c9SAttilio RaoADAPTIVE_LOCKMGRS option. 1025385e8bfSChad David.It Dv LK_CANRECURSE 1035385e8bfSChad DavidAllow recursive exclusive locks. 104008f392eSAttilio Rao.It Dv LK_NOPROFILE 105008f392eSAttilio RaoDisable lock profiling for this lock. 106f3a331b7SMaxim Konovalov.It Dv LK_NOSHARE 107f3a331b7SMaxim KonovalovAllow exclusive locks only. 108abd94b3dSAttilio Rao.It Dv LK_NOWITNESS 109abd94b3dSAttilio RaoInstruct 110abd94b3dSAttilio Rao.Xr witness 4 111abd94b3dSAttilio Raoto ignore this lock. 112abd94b3dSAttilio Rao.It Dv LK_NODUP 113abd94b3dSAttilio Rao.Xr witness 4 114abd94b3dSAttilio Raoshould log messages about duplicate locks being acquired. 115008f392eSAttilio Rao.It Dv LK_QUIET 116008f392eSAttilio RaoDisable 117008f392eSAttilio Rao.Xr ktr 4 118008f392eSAttilio Raologging for this lock. 1195385e8bfSChad David.It Dv LK_TIMELOCK 1205385e8bfSChad DavidUse 1215385e8bfSChad David.Fa timo 1225385e8bfSChad Davidduring a sleep; otherwise, 0 is used. 1235385e8bfSChad David.El 1245385e8bfSChad David.El 125e5e600c9SMark Murray.Pp 1265385e8bfSChad DavidThe 1275385e8bfSChad David.Fn lockdestroy 1285385e8bfSChad Davidfunction is used to destroy a lock, and while it is called in a number of 1295385e8bfSChad Davidplaces in the kernel, it currently does nothing. 1305385e8bfSChad David.Pp 1315385e8bfSChad DavidThe 1325385e8bfSChad David.Fn lockmgr 13348a12f89SAttilio Raoand 13448a12f89SAttilio Rao.Fn lockmgr_rw 13548a12f89SAttilio Raofunctions handle general locking functionality within the kernel, including 1365385e8bfSChad Davidsupport for shared and exclusive locks, and recursion. 1375385e8bfSChad David.Fn lockmgr 13848a12f89SAttilio Raoand 13948a12f89SAttilio Rao.Fn lockmgr_rw 14048a12f89SAttilio Raoare also able to upgrade and downgrade locks. 1415385e8bfSChad David.Pp 14248a12f89SAttilio RaoTheir arguments are: 14348a12f89SAttilio Rao.Bl -tag -width ".Fa flags" 1445385e8bfSChad David.It Fa lkp 1455385e8bfSChad DavidA pointer to the lock to manipulate. 1465385e8bfSChad David.It Fa flags 1475385e8bfSChad DavidFlags indicating what action is to be taken. 148*72ba3c08SKonstantin Belousov.Bl -tag -width ".Dv LK_NODDLKTREAT" 149e5e600c9SMark Murray.It Dv LK_SHARED 1505385e8bfSChad DavidAcquire a shared lock. 151c858f5ceSAndriy GaponIf an exclusive lock is currently held, 152c858f5ceSAndriy Gapon.Dv EDEADLK 153c858f5ceSAndriy Gaponwill be returned. 154e5e600c9SMark Murray.It Dv LK_EXCLUSIVE 1555385e8bfSChad DavidAcquire an exclusive lock. 1565385e8bfSChad DavidIf an exclusive lock is already held, and 1578271a102SRuslan Ermilov.Dv LK_CANRECURSE 1585385e8bfSChad Davidis not set, the system will 1595385e8bfSChad David.Xr panic 9 . 160e5e600c9SMark Murray.It Dv LK_DOWNGRADE 1615385e8bfSChad DavidDowngrade exclusive lock to a shared lock. 1625385e8bfSChad DavidDowngrading a shared lock is not permitted. 163c858f5ceSAndriy GaponIf an exclusive lock has been recursed, the system will 164c858f5ceSAndriy Gapon.Xr panic 9 . 1655385e8bfSChad David.It Dv LK_UPGRADE 1665385e8bfSChad DavidUpgrade a shared lock to an exclusive lock. 1675dc5cbb2SKonstantin BelousovIf this call fails, the shared lock is lost, even if the 1685dc5cbb2SKonstantin Belousov.Dv LK_NOWAIT 1695dc5cbb2SKonstantin Belousovflag is specified. 170653ed924SKonstantin BelousovDuring the upgrade, the shared lock could 171653ed924SKonstantin Belousovbe temporarily dropped. 172ffa23792SChad DavidAttempts to upgrade an exclusive lock will cause a 1735385e8bfSChad David.Xr panic 9 . 1745dc5cbb2SKonstantin Belousov.It Dv LK_TRYUPGRADE 1755dc5cbb2SKonstantin BelousovTry to upgrade a shared lock to an exclusive lock. 1765dc5cbb2SKonstantin BelousovThe failure to upgrade does not result in the dropping 1775dc5cbb2SKonstantin Belousovof the shared lock ownership. 178e5e600c9SMark Murray.It Dv LK_RELEASE 1795385e8bfSChad DavidRelease the lock. 1805385e8bfSChad DavidReleasing a lock that is not held can cause a 1815385e8bfSChad David.Xr panic 9 . 182e5e600c9SMark Murray.It Dv LK_DRAIN 1835385e8bfSChad DavidWait for all activity on the lock to end, then mark it decommissioned. 1845385e8bfSChad DavidThis is used before freeing a lock that is part of a piece of memory that is 1855385e8bfSChad Davidabout to be freed. 1865385e8bfSChad David(As documented in 187fe08efe6SRuslan Ermilov.In sys/lockmgr.h . ) 1885385e8bfSChad David.It Dv LK_SLEEPFAIL 1895385e8bfSChad DavidFail if operation has slept. 1905385e8bfSChad David.It Dv LK_NOWAIT 1915385e8bfSChad DavidDo not allow the call to sleep. 1925385e8bfSChad DavidThis can be used to test the lock. 193031e0f3cSAttilio Rao.It Dv LK_NOWITNESS 194031e0f3cSAttilio RaoSkip the 195031e0f3cSAttilio Rao.Xr witness 4 196031e0f3cSAttilio Raochecks for this instance. 1975385e8bfSChad David.It Dv LK_CANRECURSE 1985385e8bfSChad DavidAllow recursion on an exclusive lock. 1995385e8bfSChad DavidFor every lock there must be a release. 2005385e8bfSChad David.It Dv LK_INTERLOCK 2015385e8bfSChad DavidUnlock the interlock (which should be locked already). 202*72ba3c08SKonstantin Belousov.It Dv LK_NODDLKTREAT 203*72ba3c08SKonstantin BelousovNormally, 204*72ba3c08SKonstantin Belousov.Fn lockmgr 205*72ba3c08SKonstantin Belousovpostpones serving further shared requests for shared-locked lock if there is 206*72ba3c08SKonstantin Belousovexclusive waiter, to avoid exclusive lock starvation. 207*72ba3c08SKonstantin BelousovBut, if the thread requesting the shared lock already owns a shared lockmgr 208*72ba3c08SKonstantin Belousovlock, the request is granted even in presence of the parallel exclusive lock 209*72ba3c08SKonstantin Belousovrequest, which is done to avoid deadlocks with recursive shared acquisition. 210*72ba3c08SKonstantin Belousov.Pp 211*72ba3c08SKonstantin BelousovThe 212*72ba3c08SKonstantin Belousov.Dv LK_NODDLKTREAT 213*72ba3c08SKonstantin Belousovflag can only be used by code which requests shared non-recursive lock. 214*72ba3c08SKonstantin BelousovThe flag allows exclusive requests to preempt the current shared request 215*72ba3c08SKonstantin Belousoveven if the current thread owns shared locks. 216*72ba3c08SKonstantin BelousovThis is safe since shared lock is guaranteed to not recurse, and is used 217*72ba3c08SKonstantin Belousovwhen thread is known to held unrelated shared locks, to not cause 218*72ba3c08SKonstantin Belousovunneccessary starvation. An example is 219*72ba3c08SKonstantin Belousov.Dv vp 220*72ba3c08SKonstantin Belousovlocking in VFS 221*72ba3c08SKonstantin Belousov.Xr lookup 9 , 222*72ba3c08SKonstantin Belousovwhen 223*72ba3c08SKonstantin Belousov.Dv dvp 224*72ba3c08SKonstantin Belousovis already locked. 225e5e600c9SMark Murray.El 22648a12f89SAttilio Rao.It Fa ilk 2275385e8bfSChad DavidAn interlock mutex for controlling group access to the lock. 2285385e8bfSChad DavidIf 2295385e8bfSChad David.Dv LK_INTERLOCK 2305385e8bfSChad Davidis specified, 2315385e8bfSChad David.Fn lockmgr 23248a12f89SAttilio Raoand 23348a12f89SAttilio Rao.Fn lockmgr_rw 23448a12f89SAttilio Raoassume 23548a12f89SAttilio Rao.Fa ilk 2365385e8bfSChad Davidis currently owned and not recursed, and will return it unlocked. 2375385e8bfSChad DavidSee 2385385e8bfSChad David.Xr mtx_assert 9 . 2395385e8bfSChad David.El 2405385e8bfSChad David.Pp 2415385e8bfSChad DavidThe 2427f527abcSAttilio Rao.Fn lockmgr_args 24348a12f89SAttilio Raoand 24448a12f89SAttilio Rao.Fn lockmgr_args_rw 24548a12f89SAttilio Raofunction work like 2467f527abcSAttilio Rao.Fn lockmgr 24748a12f89SAttilio Raoand 24848a12f89SAttilio Rao.Fn lockmgr_rw 2497f527abcSAttilio Raobut accepting a 2507f527abcSAttilio Rao.Fa wmesg , 2517f527abcSAttilio Rao.Fa timo 2527f527abcSAttilio Raoand 2537f527abcSAttilio Rao.Fa prio 25406e361fbSChristian Bruefferon a per-instance basis. 25506e361fbSChristian BruefferThe specified values will override the default 2567f527abcSAttilio Raoones, but this can still be used passing, respectively, 2577f527abcSAttilio Rao.Dv LK_WMESG_DEFAULT , 2587f527abcSAttilio Rao.Dv LK_PRIO_DEFAULT 2597f527abcSAttilio Raoand 2607f527abcSAttilio Rao.Dv LK_TIMO_DEFAULT . 2615385e8bfSChad David.Pp 2625385e8bfSChad DavidThe 263fc2d483eSAttilio Rao.Fn lockmgr_disown 2643220cdf4SAttilio Raofunction switches the owner from the current thread to be 265fc2d483eSAttilio Rao.Dv LK_KERNPROC , 266584b5892SChristian Bruefferif the lock is already held. 267fc2d483eSAttilio Rao.Pp 268fc2d483eSAttilio RaoThe 2695385e8bfSChad David.Fn lockmgr_printinfo 2705385e8bfSChad Davidfunction prints debugging information about the lock. 2715385e8bfSChad DavidIt is used primarily by 2725385e8bfSChad David.Xr VOP_PRINT 9 2735385e8bfSChad Davidfunctions. 274fa885265SAttilio Rao.Pp 275fa885265SAttilio RaoThe 276fa885265SAttilio Rao.Fn lockmgr_recursed 277fa885265SAttilio Raofunction returns true if the lock is recursed, 0 278fa885265SAttilio Raootherwise. 279f0c5fe2dSAttilio Rao.Pp 2807f527abcSAttilio RaoThe 281b4b811faSChristian Brueffer.Fn lockmgr_waiters 282b4b811faSChristian Bruefferfunction returns true if the lock has waiters, 0 otherwise. 283b4b811faSChristian Brueffer.Pp 284b4b811faSChristian BruefferThe 2857f527abcSAttilio Rao.Fn lockstatus 2867f527abcSAttilio Raofunction returns the status of the lock in relation to the current thread. 2877f527abcSAttilio Rao.Pp 288f0c5fe2dSAttilio RaoWhen compiled with 289f0c5fe2dSAttilio Rao.Cd "options INVARIANTS" 290f0c5fe2dSAttilio Raoand 291f0c5fe2dSAttilio Rao.Cd "options INVARIANT_SUPPORT" , 292f0c5fe2dSAttilio Raothe 293f0c5fe2dSAttilio Rao.Fn lockmgr_assert 294f0c5fe2dSAttilio Raofunction tests 295f0c5fe2dSAttilio Rao.Fa lkp 296f0c5fe2dSAttilio Raofor the assertions specified in 297f0c5fe2dSAttilio Rao.Fa what , 298f0c5fe2dSAttilio Raoand panics if they are not met. 299f0c5fe2dSAttilio RaoOne of the following assertions must be specified: 300f0c5fe2dSAttilio Rao.Bl -tag -width ".Dv KA_UNLOCKED" 301f0c5fe2dSAttilio Rao.It Dv KA_LOCKED 302f0c5fe2dSAttilio RaoAssert that the current thread has either a shared or an exclusive lock on the 303f0c5fe2dSAttilio Rao.Vt lkp 304f0c5fe2dSAttilio Raolock pointed to by the first argument. 305f0c5fe2dSAttilio Rao.It Dv KA_SLOCKED 306f0c5fe2dSAttilio RaoAssert that the current thread has a shared lock on the 307f0c5fe2dSAttilio Rao.Vt lkp 308f0c5fe2dSAttilio Raolock pointed to by the first argument. 309f0c5fe2dSAttilio Rao.It Dv KA_XLOCKED 310f0c5fe2dSAttilio RaoAssert that the current thread has an exclusive lock on the 311f0c5fe2dSAttilio Rao.Vt lkp 312f0c5fe2dSAttilio Raolock pointed to by the first argument. 313f0c5fe2dSAttilio Rao.It Dv KA_UNLOCKED 314f0c5fe2dSAttilio RaoAssert that the current thread has no lock on the 315f0c5fe2dSAttilio Rao.Vt lkp 316f0c5fe2dSAttilio Raolock pointed to by the first argument. 317f0c5fe2dSAttilio Rao.El 318f0c5fe2dSAttilio Rao.Pp 319f0c5fe2dSAttilio RaoIn addition, one of the following optional assertions can be used with 320f0c5fe2dSAttilio Raoeither an 321f0c5fe2dSAttilio Rao.Dv KA_LOCKED , 322f0c5fe2dSAttilio Rao.Dv KA_SLOCKED , 323f0c5fe2dSAttilio Raoor 324f0c5fe2dSAttilio Rao.Dv KA_XLOCKED 325f0c5fe2dSAttilio Raoassertion: 326f0c5fe2dSAttilio Rao.Bl -tag -width ".Dv KA_NOTRECURSED" 327f0c5fe2dSAttilio Rao.It Dv KA_RECURSED 328f0c5fe2dSAttilio RaoAssert that the current thread has a recursed lock on 329f0c5fe2dSAttilio Rao.Fa lkp . 330f0c5fe2dSAttilio Rao.It Dv KA_NOTRECURSED 331af176d73SChristian BruefferAssert that the current thread does not have a recursed lock on 332f0c5fe2dSAttilio Rao.Fa lkp . 333f0c5fe2dSAttilio Rao.El 334e5e600c9SMark Murray.Sh RETURN VALUES 3355385e8bfSChad DavidThe 3365385e8bfSChad David.Fn lockmgr 33748a12f89SAttilio Raoand 33848a12f89SAttilio Rao.Fn lockmgr_rw 33948a12f89SAttilio Raofunctions return 0 on success and non-zero on failure. 3405385e8bfSChad David.Pp 3415385e8bfSChad DavidThe 3425385e8bfSChad David.Fn lockstatus 3435385e8bfSChad Davidfunction returns: 3445385e8bfSChad David.Bl -tag -width ".Dv LK_EXCLUSIVE" 3455385e8bfSChad David.It Dv LK_EXCLUSIVE 3463220cdf4SAttilio RaoAn exclusive lock is held by the current thread. 3475385e8bfSChad David.It Dv LK_EXCLOTHER 3483220cdf4SAttilio RaoAn exclusive lock is held by someone other than the current thread. 3495385e8bfSChad David.It Dv LK_SHARED 3505385e8bfSChad DavidA shared lock is held. 3515385e8bfSChad David.It Li 0 3525385e8bfSChad DavidThe lock is not held by anyone. 3535385e8bfSChad David.El 3545385e8bfSChad David.Sh ERRORS 3555385e8bfSChad David.Fn lockmgr 35648a12f89SAttilio Raoand 35748a12f89SAttilio Rao.Fn lockmgr_rw 35848a12f89SAttilio Raofail if: 3595385e8bfSChad David.Bl -tag -width Er 3605385e8bfSChad David.It Bq Er EBUSY 3618271a102SRuslan Ermilov.Dv LK_FORCEUPGRADE 3625385e8bfSChad Davidwas requested and another thread had already requested a lock upgrade. 3635385e8bfSChad David.It Bq Er EBUSY 3645385e8bfSChad David.Dv LK_NOWAIT 3655dc5cbb2SKonstantin Belousovwas set, and a sleep would have been required, or 3665dc5cbb2SKonstantin Belousov.Dv LK_TRYUPGRADE 3675dc5cbb2SKonstantin Belousovoperation was not able to upgrade the lock. 3685385e8bfSChad David.It Bq Er ENOLCK 3698271a102SRuslan Ermilov.Dv LK_SLEEPFAIL 3705385e8bfSChad Davidwas set and 3715385e8bfSChad David.Fn lockmgr 37248a12f89SAttilio Raoor 37348a12f89SAttilio Rao.Fn lockmgr_rw 3745385e8bfSChad Daviddid sleep. 3755385e8bfSChad David.It Bq Er EINTR 3768271a102SRuslan Ermilov.Dv PCATCH 3775385e8bfSChad Davidwas set in the lock priority, and a signal was delivered during a sleep. 3785385e8bfSChad DavidNote the 379e5e600c9SMark Murray.Er ERESTART 3805385e8bfSChad Daviderror below. 3815385e8bfSChad David.It Bq Er ERESTART 3825385e8bfSChad David.Dv PCATCH 3835385e8bfSChad Davidwas set in the lock priority, a signal was delivered during a sleep, 3845385e8bfSChad Davidand the system call is to be restarted. 3855385e8bfSChad David.It Bq Er EWOULDBLOCK 3865385e8bfSChad Davida non-zero timeout was given, and the timeout expired. 3875385e8bfSChad David.El 3885385e8bfSChad David.Sh LOCKS 3895385e8bfSChad DavidIf 3905385e8bfSChad David.Dv LK_INTERLOCK 3915385e8bfSChad Davidis passed in the 3925385e8bfSChad David.Fa flags 3935385e8bfSChad Davidargument to 39448a12f89SAttilio Rao.Fn lockmgr 39548a12f89SAttilio Raoor 39648a12f89SAttilio Rao.Fn lockmgr_rw , 3975385e8bfSChad Davidthe 39848a12f89SAttilio Rao.Fa ilk 3995385e8bfSChad Davidmust be held prior to calling 40048a12f89SAttilio Rao.Fn lockmgr 40148a12f89SAttilio Raoor 40248a12f89SAttilio Rao.Fn lockmgr_rw , 4035385e8bfSChad Davidand will be returned unlocked. 4045385e8bfSChad David.Pp 4055385e8bfSChad DavidUpgrade attempts that fail result in the loss of the lock that 4065385e8bfSChad Davidis currently held. 4075385e8bfSChad DavidAlso, it is invalid to upgrade an 4085385e8bfSChad Davidexclusive lock, and a 4095385e8bfSChad David.Xr panic 9 4105385e8bfSChad Davidwill be the result of trying. 4115385e8bfSChad David.Sh SEE ALSO 412a280550aSJulian Elischer.Xr condvar 9 , 413a280550aSJulian Elischer.Xr locking 9 , 414a280550aSJulian Elischer.Xr mutex 9 , 415a280550aSJulian Elischer.Xr rwlock 9 , 416e7573e7aSJohn Baldwin.Xr sleep 9 , 417a280550aSJulian Elischer.Xr sx 9 , 4185385e8bfSChad David.Xr mtx_assert 9 , 4195385e8bfSChad David.Xr panic 9 , 4205385e8bfSChad David.Xr VOP_PRINT 9 4215385e8bfSChad David.Sh AUTHORS 422571dba6eSHiten PandyaThis manual page was written by 4238a7314fcSBaptiste Daroussin.An Chad David Aq Mt davidc@acns.ab.ca . 424