git: kernel - Fix rare lockmgr() state transition (2)

Matthew Dillon dillon at crater.dragonflybsd.org
Mon Oct 2 18:43:41 PDT 2017


commit bb36d905d2bf2569ce40fc3ebdab1877ae6342bf
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sun Oct 1 11:18:49 2017 -0700

    kernel - Fix rare lockmgr() state transition (2)
    
    * Fix two lock timeout cases for LK_EXCLUPGRADE and LK_UPGRADE, and
      fix a bug in undo_upreq().
    
    * A tsleep failure (such as the LK_TIMELOCK case via
      vm_map_lock_read_to()) was not properly backing-out a LKC_UPREQ,
      resulting in a situation where the lock becomes exclusively owned
      by nobody and deadlocks against all-comers.  Fix by properly
      calling undo_upreq().
    
    * Fix a bug in undo_upreq() itself.  When undoing a granted UPREQ,
      the lockholder must be set prior to releasing the now-granted
      exclusive lock in order to avoid an assertion panic.
    
    * While we are at it, replace a weird cmpset count,count with a
      fetchadd(count, 0).

Summary of changes:
 share/man/man9/lock.9 | 22 ++++++++++++++++------
 sys/kern/kern_lock.c  | 13 +++++++++----
 2 files changed, 25 insertions(+), 10 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/bb36d905d2bf2569ce40fc3ebdab1877ae6342bf


-- 
DragonFly BSD source repository



More information about the Commits mailing list