diff options
author | marcel <marcel@FreeBSD.org> | 2013-05-09 16:28:18 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2013-05-09 16:28:18 +0000 |
commit | bd49099038824e1817f3a5da01c52f82eebe392e (patch) | |
tree | 535b854fe8328f0254c6ce52fdd275b2f12140ed /sys/kern | |
parent | ce591b770b2ff012762738cb1f1bfeea4003d36c (diff) | |
download | FreeBSD-src-bd49099038824e1817f3a5da01c52f82eebe392e.zip FreeBSD-src-bd49099038824e1817f3a5da01c52f82eebe392e.tar.gz |
Add option WITNESS_NO_VNODE to suppress printing LORs between VNODE
locks. To support this, VNODE locks are created with the LK_IS_VNODE
flag. This flag is propagated down using the LO_IS_VNODE flag.
Note that WITNESS still records the LOR. Only the printing and the
optional entering into the kernel debugger is bypassed with the
WITNESS_NO_VNODE option.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_lock.c | 2 | ||||
-rw-r--r-- | sys/kern/subr_witness.c | 14 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 2 |
3 files changed, 16 insertions, 2 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 7962ae1..849f583 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -393,6 +393,8 @@ lockinit(struct lock *lk, int pri, const char *wmesg, int timo, int flags) iflags |= LO_WITNESS; if (flags & LK_QUIET) iflags |= LO_QUIET; + if (flags & LK_IS_VNODE) + iflags |= LO_IS_VNODE; iflags |= flags & (LK_ADAPTIVE | LK_NOSHARE); lk->lk_lock = LK_UNLOCKED; diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index b30bf08..ac7636ae 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -1289,7 +1289,19 @@ witness_checkorder(struct lock_object *lock, int flags, const char *file, w->w_reversed = w1->w_reversed = 1; witness_increment_graph_generation(); mtx_unlock_spin(&w_mtx); - + +#ifdef WITNESS_NO_VNODE + /* + * There are known LORs between VNODE locks. They are + * not an indication of a bug. VNODE locks are flagged + * as such (LO_IS_VNODE) and we don't yell if the LOR + * is between 2 VNODE locks. + */ + if ((lock->lo_flags & LO_IS_VNODE) != 0 && + (lock1->li_lock->lo_flags & LO_IS_VNODE) != 0) + return; +#endif + /* * Ok, yell about it. */ diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index de118f7..d9cbde2 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1037,7 +1037,7 @@ alloc: * By default, don't allow shared locks unless filesystems * opt-in. */ - lockinit(vp->v_vnlock, PVFS, tag, VLKTIMEOUT, LK_NOSHARE); + lockinit(vp->v_vnlock, PVFS, tag, VLKTIMEOUT, LK_NOSHARE | LK_IS_VNODE); /* * Initialize bufobj. */ |