diff options
author | Attilio Rao <attilio@FreeBSD.org> | 2009-06-02 13:03:35 +0000 |
---|---|---|
committer | Attilio Rao <attilio@FreeBSD.org> | 2009-06-02 13:03:35 +0000 |
commit | f0830182234c4e185eab23ca0c76f5248581362f (patch) | |
tree | 0574452322c16cb1cd1a6d29e497620399499dff /sys/kern/kern_lock.c | |
parent | 11632ace3ababb6b3920643acf75b7de089d6fbb (diff) | |
download | src-f0830182234c4e185eab23ca0c76f5248581362f.tar.gz src-f0830182234c4e185eab23ca0c76f5248581362f.zip |
Handle lock recursion differenty by always checking against LO_RECURSABLE
instead the lock own flag itself.
Tested by: pho
Notes
Notes:
svn path=/head/; revision=193307
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r-- | sys/kern/kern_lock.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index f03ddbca687d..c365e6587c20 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -51,8 +51,7 @@ __FBSDID("$FreeBSD$"); #include <ddb/ddb.h> #endif -CTASSERT(((LK_CANRECURSE | LK_NOSHARE) & LO_CLASSFLAGS) == - (LK_CANRECURSE | LK_NOSHARE)); +CTASSERT((LK_NOSHARE & LO_CLASSFLAGS) == LK_NOSHARE); #define SQ_EXCLUSIVE_QUEUE 0 #define SQ_SHARED_QUEUE 1 @@ -316,7 +315,9 @@ lockinit(struct lock *lk, int pri, const char *wmesg, int timo, int flags) MPASS((flags & ~LK_INIT_MASK) == 0); - iflags = LO_RECURSABLE | LO_SLEEPABLE | LO_UPGRADABLE; + iflags = LO_SLEEPABLE | LO_UPGRADABLE; + if (flags & LK_CANRECURSE) + iflags |= LO_RECURSABLE; if ((flags & LK_NODUP) == 0) iflags |= LO_DUPOK; if (flags & LK_NOPROFILE) @@ -325,7 +326,7 @@ lockinit(struct lock *lk, int pri, const char *wmesg, int timo, int flags) iflags |= LO_WITNESS; if (flags & LK_QUIET) iflags |= LO_QUIET; - iflags |= flags & (LK_CANRECURSE | LK_NOSHARE); + iflags |= flags & LK_NOSHARE; lk->lk_lock = LK_UNLOCKED; lk->lk_recurse = 0; @@ -530,7 +531,7 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk, */ if (lockmgr_xlocked(lk)) { if ((flags & LK_CANRECURSE) == 0 && - (lk->lock_object.lo_flags & LK_CANRECURSE) == 0) { + (lk->lock_object.lo_flags & LO_RECURSABLE) == 0) { /* * If the lock is expected to not panic just |