summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>2001-12-20 22:42:27 +0000
committerdillon <dillon@FreeBSD.org>2001-12-20 22:42:27 +0000
commitac9876d609290ddd585a1e5a67550061f01c20dd (patch)
tree74464ed2703c6925992ebe509294859864e96118 /sys/kern/kern_lock.c
parent53b1a7ecefc98fa3a2e71925a3be359d4873214b (diff)
downloadFreeBSD-src-ac9876d609290ddd585a1e5a67550061f01c20dd.zip
FreeBSD-src-ac9876d609290ddd585a1e5a67550061f01c20dd.tar.gz
Fix a BUF_TIMELOCK race against BUF_LOCK and fix a deadlock in vget()
against VM_WAIT in the pageout code. Both fixes involve adjusting the lockmgr's timeout capability so locks obtained with timeouts do not interfere with locks obtained without a timeout. Hopefully MFC: before the 4.5 release
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r--sys/kern/kern_lock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index c7d4f24..929be46 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -166,7 +166,8 @@ acquire(struct lock *lkp, int extflags, int wanted) {
lkp->lk_flags |= LK_WAIT_NONZERO;
lkp->lk_waitcount++;
error = msleep(lkp, lkp->lk_interlock, lkp->lk_prio,
- lkp->lk_wmesg, lkp->lk_timo);
+ lkp->lk_wmesg,
+ ((extflags & LK_TIMELOCK) ? lkp->lk_timo : 0));
if (lkp->lk_waitcount == 1) {
lkp->lk_flags &= ~LK_WAIT_NONZERO;
lkp->lk_waitcount = 0;
@@ -469,7 +470,8 @@ acquiredrain(struct lock *lkp, int extflags) {
while (lkp->lk_flags & LK_ALL) {
lkp->lk_flags |= LK_WAITDRAIN;
error = msleep(&lkp->lk_flags, lkp->lk_interlock, lkp->lk_prio,
- lkp->lk_wmesg, lkp->lk_timo);
+ lkp->lk_wmesg,
+ ((extflags & LK_TIMELOCK) ? lkp->lk_timo : 0));
if (error)
return error;
if (extflags & LK_SLEEPFAIL) {
OpenPOWER on IntegriCloud