Fix the LK_NOSHARE lockmgr flag interaction with LK_UPGRADE and

LK_DOWNGRADE lock ops. Namely, the ops should be NOP since LK_NOSHARE
locks are always exclusive.

Reported by:	rmacklem
Reviewed by:	attilio
Tested by:	pho
Approved by:	re (kensmith)
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2011-08-01 19:07:03 +00:00
parent abd51cd84a
commit d0a724c5ea

View File

@ -477,8 +477,18 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk,
return (0);
}
if (op == LK_SHARED && (lk->lock_object.lo_flags & LK_NOSHARE))
if (lk->lock_object.lo_flags & LK_NOSHARE) {
switch (op) {
case LK_SHARED:
op = LK_EXCLUSIVE;
break;
case LK_UPGRADE:
case LK_DOWNGRADE:
_lockmgr_assert(lk, KA_XLOCKED | KA_NOTRECURSED,
file, line);
return (0);
}
}
wakeup_swapper = 0;
switch (op) {