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.
This commit is contained in:
Marcel Moolenaar 2013-05-09 16:28:18 +00:00
parent a28232e303
commit e63091ea6c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=250411
6 changed files with 19 additions and 2 deletions

View File

@ -672,6 +672,7 @@ KTR_ENTRIES opt_global.h
KTR_VERBOSE opt_ktr.h
WITNESS opt_global.h
WITNESS_KDB opt_witness.h
WITNESS_NO_VNODE opt_witness.h
WITNESS_SKIPSPIN opt_witness.h
# options for ACPI support

View File

@ -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;

View File

@ -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.
*/

View File

@ -1037,7 +1037,7 @@ getnewvnode(const char *tag, struct mount *mp, struct vop_vector *vops,
* 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.
*/

View File

@ -79,6 +79,7 @@ struct lock_class {
#define LO_SLEEPABLE 0x00100000 /* Lock may be held while sleeping. */
#define LO_UPGRADABLE 0x00200000 /* Lock may be upgraded/downgraded. */
#define LO_DUPOK 0x00400000 /* Don't check for duplicate acquires */
#define LO_IS_VNODE 0x00800000 /* Tell WITNESS about a VNODE lock */
#define LO_CLASSMASK 0x0f000000 /* Class index bitmask. */
#define LO_NOPROFILE 0x10000000 /* Don't profile this lock */

View File

@ -146,6 +146,7 @@ _lockmgr_args_rw(struct lock *lk, u_int flags, struct rwlock *ilk,
#define LK_NOWITNESS 0x000010
#define LK_QUIET 0x000020
#define LK_ADAPTIVE 0x000040
#define LK_IS_VNODE 0x000080 /* Tell WITNESS about a VNODE lock */
/*
* Additional attributes to be used in lockmgr().