DragonFly BSD
DragonFly commits List (threaded) for 2012-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

git: kernel - Change lockmgr LK_SHARED behavior to fix improper recursion return


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 16 Aug 2012 18:08:52 -0700 (PDT)

commit 87f32d7cb3198c80dd8299ecdd884e86d5ac69f9
Author: Matthew Dillon <dillon@apollo.backplane.com>
Date:   Thu Aug 16 17:40:38 2012 -0700

    kernel - Change lockmgr LK_SHARED behavior to fix improper recursion return
    
    * When obtaining a LK_SHARED lock in a situation where you already own the
      lock LK_EXCLUSIVE, lockmgr would downgrade the lock to shared.
    
      This creates a very serious problem when large procedural recursions get
      a lock that is already being held exclusively but request a shared lock.
      When these recursions return the original top level will find its lock is
      no longer exclusive.
    
    * This problem occured with vnode locks when a VOP_WRITE operation on a mmap'd
      space causes a VM fault which then turns around and issues a read().
      When the fault returns the vnode wound up locked shared instead of
      exclusive.
    
    * Fix the problem by NOT downgrading an exclusive lock to shared when
      recursing on LK_SHARED.  Simply add another count to the exclusive
      lock.

Summary of changes:
 sys/kern/kern_lock.c      |   29 +++++++++++++++++++++++++++--
 sys/vfs/ufs/ffs_rawread.c |   14 --------------
 2 files changed, 27 insertions(+), 16 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/87f32d7cb3198c80dd8299ecdd884e86d5ac69f9


-- 
DragonFly BSD source repository



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]