diff options
| author | Alexander Kabaev <kan@FreeBSD.org> | 2004-08-16 15:01:22 +0000 |
|---|---|---|
| committer | Alexander Kabaev <kan@FreeBSD.org> | 2004-08-16 15:01:22 +0000 |
| commit | c8b876219f9784c87cf5b718242f81f0f7da7905 (patch) | |
| tree | b367fcda56a40b13622f29f1e200012e1753f08a | |
| parent | f03b27517bb00da08576f04e7354468aadecb63f (diff) | |
Notes
| -rw-r--r-- | sys/kern/kern_lock.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index c819ba1861116..f1b6a427a126a 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -335,8 +335,12 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) error = acquire(&lkp, extflags, LK_SHARE_NONZERO); lkp->lk_flags &= ~LK_WANT_UPGRADE; - if (error) - break; + if (error) { + if ((lkp->lk_flags & ( LK_WANT_EXCL | LK_WAIT_NONZERO)) == (LK_WANT_EXCL | LK_WAIT_NONZERO)) + wakeup((void *)lkp); + break; + } + lkp->lk_flags |= LK_HAVE_EXCL; lkp->lk_lockholder = thr; if (lkp->lk_exclusivecount != 0) @@ -382,17 +386,20 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) /* * Try to acquire the want_exclusive flag. */ - error = acquire(&lkp, extflags, (LK_HAVE_EXCL | LK_WANT_EXCL)); + error = acquire(&lkp, extflags, LK_WANT_EXCL); if (error) break; lkp->lk_flags |= LK_WANT_EXCL; /* * Wait for shared locks and upgrades to finish. */ - error = acquire(&lkp, extflags, LK_WANT_UPGRADE | LK_SHARE_NONZERO); + error = acquire(&lkp, extflags, LK_HAVE_EXCL | LK_WANT_UPGRADE | LK_SHARE_NONZERO); lkp->lk_flags &= ~LK_WANT_EXCL; - if (error) + if (error) { + if (lkp->lk_flags & LK_WAIT_NONZERO) + wakeup((void *)lkp); break; + } lkp->lk_flags |= LK_HAVE_EXCL; lkp->lk_lockholder = thr; if (lkp->lk_exclusivecount != 0) |
