Add function and wrapper to switch lockmgr and vnode lock back to

auto-promotion of shared to exclusive.

Approved by:	re (gjb)
This commit is contained in:
kib 2014-09-05 13:22:28 +00:00
parent ddbdadae3d
commit 78a27e5e59
3 changed files with 10 additions and 0 deletions

View File

@ -418,6 +418,14 @@ lockallowshare(struct lock *lk)
lk->lock_object.lo_flags &= ~LK_NOSHARE; lk->lock_object.lo_flags &= ~LK_NOSHARE;
} }
void
lockdisableshare(struct lock *lk)
{
lockmgr_assert(lk, KA_XLOCKED);
lk->lock_object.lo_flags |= LK_NOSHARE;
}
void void
lockallowrecurse(struct lock *lk) lockallowrecurse(struct lock *lk)
{ {

View File

@ -77,6 +77,7 @@ void lockallowrecurse(struct lock *lk);
void lockallowshare(struct lock *lk); void lockallowshare(struct lock *lk);
void lockdestroy(struct lock *lk); void lockdestroy(struct lock *lk);
void lockdisablerecurse(struct lock *lk); void lockdisablerecurse(struct lock *lk);
void lockdisableshare(struct lock *lk);
void lockinit(struct lock *lk, int prio, const char *wmesg, int timo, void lockinit(struct lock *lk, int prio, const char *wmesg, int timo,
int flags); int flags);
#ifdef DDB #ifdef DDB

View File

@ -428,6 +428,7 @@ extern struct vattr va_null; /* predefined null vattr structure */
#define VN_LOCK_AREC(vp) lockallowrecurse((vp)->v_vnlock) #define VN_LOCK_AREC(vp) lockallowrecurse((vp)->v_vnlock)
#define VN_LOCK_ASHARE(vp) lockallowshare((vp)->v_vnlock) #define VN_LOCK_ASHARE(vp) lockallowshare((vp)->v_vnlock)
#define VN_LOCK_DSHARE(vp) lockdisableshare((vp)->v_vnlock)
#endif /* _KERNEL */ #endif /* _KERNEL */