kernel - Fix rare lockmgr() state transition
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 30 Sep 2017 22:12:30 +0000 (15:12 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 1 Oct 2017 01:10:22 +0000 (18:10 -0700)
commit616bc26b4964cc05c0649e6fa65cc5eb2f5b50f4
tree400662a340eb1092e62d12962972754549a2ccfd
parent80237f44a59521924450b85427898ab0606b8b32
kernel - Fix rare lockmgr() state transition

* When lockmgr() is releasing the last count on an exclusive lock
  with an upgrade request pending, and the atomic op fails, the
  code fails to properly retry.  Fixed by properly retrying.

* This situation should not be possible to even get into, hence 'rare'.
  It requires UPREQ to be set while the lock is being held exclusively,
  which should never be possible because there is no shared lock holder
  in that case who might attempt to upgrade.

  I checked race conditions when multiple shared holders attempt
  to upgrade but all that happens is that one will release and
  acquire a normal exclusive lock instead.
sys/kern/kern_lock.c