aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2005-01-24 10:20:59 +0000
committerJeff Roberson <jeff@FreeBSD.org>2005-01-24 10:20:59 +0000
commit41bd6c15f2580e622597a0c7fad2da23df878fea (patch)
treec8cb5b79a1890a98892ea8d72ebd874a1df4a4ec /sys/kern/kern_lock.c
parent66ca1b4878e0cfdfd652f1bd3b3b4a6f6abedd0e (diff)
downloadsrc-41bd6c15f2580e622597a0c7fad2da23df878fea.tar.gz
src-41bd6c15f2580e622597a0c7fad2da23df878fea.zip
- Do not use APAUSE if LK_INTERLOCK is set. We lose synchronization
if the lockmgr interlock is dropped after the caller's interlock is dropped. - Change some lockmgr KTRs to be slightly more helpful. Sponsored By: Isilon Systems, Inc.
Notes
Notes: svn path=/head/; revision=140711
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r--sys/kern/kern_lock.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index 896d88aa4984..0410896eaaf1 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -136,10 +136,10 @@ apause(struct lock *lkp, int flags)
}
static int
-acquire(struct lock **lkpp, int extflags, int wanted) {
+acquire(struct lock **lkpp, int extflags, int wanted)
+{
struct lock *lkp = *lkpp;
int s, error;
-
CTR3(KTR_LOCK,
"acquire(): lkp == %p, extflags == 0x%x, wanted == 0x%x",
lkp, extflags, wanted);
@@ -148,7 +148,7 @@ acquire(struct lock **lkpp, int extflags, int wanted) {
return EBUSY;
}
- if (((lkp->lk_flags | extflags) & LK_NOPAUSE) == 0) {
+ if (((lkp->lk_flags | extflags) & (LK_NOPAUSE|LK_INTERLOCK)) == 0) {
error = apause(lkp, wanted);
if (error == 0)
return 0;
@@ -214,10 +214,6 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line)
struct thread *thr;
int extflags, lockflags;
- CTR5(KTR_LOCK,
- "lockmgr(): lkp == %p (lk_wmesg == \"%s\"), flags == 0x%x, "
- "interlkp == %p, td == %p", lkp, lkp->lk_wmesg, flags, interlkp, td);
-
error = 0;
if (td == NULL)
thr = LK_KERNPROC;
@@ -226,6 +222,17 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line)
if ((flags & LK_INTERNAL) == 0)
mtx_lock(lkp->lk_interlock);
+#ifdef DEBUG_LOCKS
+ CTR6(KTR_LOCK,
+ "lockmgr(): lkp == %p (lk_wmesg == \"%s\"), flags == 0x%x, "
+ "td == %p %s:%d", lkp, lkp->lk_wmesg, flags, td, file, line);
+#else
+ CTR6(KTR_LOCK,
+ "lockmgr(): lkp == %p (lk_wmesg == \"%s\"), owner == %p, exclusivecount == %d, flags == 0x%x, "
+ "td == %p", lkp, lkp->lk_wmesg, lkp->lk_lockholder,
+ lkp->lk_exclusivecount, flags, td);
+#endif
+
if (flags & LK_INTERLOCK) {
mtx_assert(interlkp, MA_OWNED | MA_NOTRECURSED);
mtx_unlock(interlkp);
@@ -479,9 +486,11 @@ acquiredrain(struct lock *lkp, int extflags) {
return EBUSY;
}
- error = apause(lkp, LK_ALL);
- if (error == 0)
- return 0;
+ if ((extflags & LK_INTERLOCK) == 0) {
+ error = apause(lkp, LK_ALL);
+ if (error == 0)
+ return 0;
+ }
while (lkp->lk_flags & LK_ALL) {
lkp->lk_flags |= LK_WAITDRAIN;