diff options
author | Ryan Libby <rlibby@FreeBSD.org> | 2019-11-27 01:54:39 +0000 |
---|---|---|
committer | Ryan Libby <rlibby@FreeBSD.org> | 2019-11-27 01:54:39 +0000 |
commit | 59fb4a95c7f291f0cbbda1d56d3c7075410fca31 (patch) | |
tree | 23232013b78d1f6a3b5216a00087d111dd8a39e7 /sys/kern/kern_rmlock.c | |
parent | 588e69e2fde146bab5ea3600f3d13a457ba318f2 (diff) | |
download | src-59fb4a95c7f291f0cbbda1d56d3c7075410fca31.tar.gz src-59fb4a95c7f291f0cbbda1d56d3c7075410fca31.zip |
witness: sleepable rm locks are not sleepable in read mode
There are two classes of rm lock, one "sleepable" and one not. But even
a "sleepable" rm lock is only sleepable in write mode, and is
non-sleepable when taken in read mode.
Warn about sleepable rm locks in read mode as non-sleepable locks. Do
this by defining a new lock operation flag, LOP_NOSLEEP, to indicate
that a lock is non-sleepable despite what the LO_SLEEPABLE flag would
indicate, and defining a new witness lock instance flag, LI_SLEEPABLE,
to track the product of LO_SLEEPABLE and LOP_NOSLEEP on the lock
instance.
Reviewed by: markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22527
Notes
Notes:
svn path=/head/; revision=355126
Diffstat (limited to 'sys/kern/kern_rmlock.c')
-rw-r--r-- | sys/kern/kern_rmlock.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index 5cb18fbfa582..96e11276e9b2 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -652,8 +652,8 @@ _rm_rlock_debug(struct rmlock *rm, struct rm_priotracker *tracker, KASSERT(!rm_wowned(rm), ("rm_rlock: wlock already held for %s @ %s:%d", rm->lock_object.lo_name, file, line)); - WITNESS_CHECKORDER(&rm->lock_object, LOP_NEWORDER, file, line, - NULL); + WITNESS_CHECKORDER(&rm->lock_object, + LOP_NEWORDER | LOP_NOSLEEP, file, line, NULL); } if (_rm_rlock(rm, tracker, trylock)) { @@ -663,7 +663,7 @@ _rm_rlock_debug(struct rmlock *rm, struct rm_priotracker *tracker, else LOCK_LOG_LOCK("RMRLOCK", &rm->lock_object, 0, 0, file, line); - WITNESS_LOCK(&rm->lock_object, 0, file, line); + WITNESS_LOCK(&rm->lock_object, LOP_NOSLEEP, file, line); TD_LOCKS_INC(curthread); return (1); } else if (trylock) |