1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-01 12:19:28 +00:00

In order to avoid a huge class of deadlocks (in particular in interactions

with the interlock), owner of the lock should be only curthread or at
least, for its limited usage, NULL which identifies LK_KERNPROC.

The thread "extra argument" for the lockmgr interface is going to be
removed in the near future, but for the moment, just let kernel run for
some days with this check on in order to find potential deadlocking
places around the kernel and fix them.
This commit is contained in:
Attilio Rao 2007-12-27 22:56:57 +00:00
parent 0417fe5421
commit 7a1d78fa3f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=174948

View File

@ -198,7 +198,15 @@ _lockmgr(struct lock *lkp, u_int flags, struct mtx *interlkp,
int extflags, lockflags;
int contested = 0;
uint64_t waitstart = 0;
/*
* Lock owner can only be curthread or, at least, NULL in order to
* have a deadlock free implementation of the primitive.
*/
KASSERT(td == NULL || td == curthread,
("lockmgr: owner thread (%p) cannot differ from curthread or NULL",
td));
error = 0;
if (td == NULL)
thr = LK_KERNPROC;