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:14:51 +0000 (18:14 -0700)
commit865c39cae85ed3b8898c7a31f305458c0e28aac1
treea039200d3432520343088580c95faf8fe2c27c29
parent21ddb9de356a094f741915448ca36c9404acaf09
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