git: hammer2 - Fix persist_refs race on chain IPC

Matthew Dillon dillon at crater.dragonflybsd.org
Thu Aug 24 09:50:23 PDT 2017


commit 2047e76a71be76c884fcc9ce3b23139fd91e38ee
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Thu Aug 24 09:47:00 2017 -0700

    hammer2 - Fix persist_refs race on chain IPC
    
    * The chain->lockcnt and chain->persist_refs mechanism was poorly
      implemented and had a race which could leave chain->data intact
      on the last unlock and/or cause memory corruption.
    
    * Fold persist_refs into lockcnt and remove persist_refs.  Obtain or
      upgrade the mutex to exclusive BEFORE doing the 1->0 transition.
      Still not perfect, but shouldn't have any more holes.

Summary of changes:
 sys/vfs/hammer2/hammer2.h       |   2 +-
 sys/vfs/hammer2/hammer2_chain.c | 113 ++++++++++++++++++++++++----------------
 2 files changed, 69 insertions(+), 46 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/2047e76a71be76c884fcc9ce3b23139fd91e38ee


-- 
DragonFly BSD source repository



More information about the Commits mailing list