git: hammer2 - Fix upgrade deadlock

Matthew Dillon dillon at crater.dragonflybsd.org
Fri Jun 10 21:15:18 PDT 2016


commit b6b260f2b42aa5a135e4b57ce102dcb0dbbf88c3
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Fri Jun 10 11:25:58 2016 -0700

    hammer2 - Fix upgrade deadlock
    
    * Fix a deadlock which occurs when hammer2_chain_unlock() tries to
      upgrade the 'last' shared lock to exclusive.  This can deadlock if
      another thread obtains the chain shared before we manage to do the
      upgrade.
    
      Just use a 'try' here.  If it fails it means someone else got a lock
      (of any kind) and we don't have to worry about dropping the chain data.
    
    * Replace hammer2_mtx_upgrade() with hammer2_mtx_upgrade_try().  Remove
      support for a blocking 'upgrade'.  It is no longer needed and it is
      too dangerous to have anyway.

Summary of changes:
 sys/vfs/hammer2/hammer2.h       | 13 ++-----------
 sys/vfs/hammer2/hammer2_chain.c |  9 ++++++---
 2 files changed, 8 insertions(+), 14 deletions(-)

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


-- 
DragonFly BSD source repository



More information about the Commits mailing list