git: hammer2 - Fix corruption on sync, fix excessive stall, optimize sideq

Matthew Dillon dillon at
Tue Sep 19 01:42:51 PDT 2017

commit 19808ac9def29b202ea81814cdcc32d74b53c466
Author: Matthew Dillon <dillon at>
Date:   Tue Sep 19 01:35:41 2017 -0700

    hammer2 - Fix corruption on sync, fix excessive stall, optimize sideq
    * Fix topology corruption which can occur due to the new
      hammer2_chain_indirect_maintenance() code.  This code can make
      modifications to the parent from inside the flush code itself.
      This can cause the flush code's RB_SCAN() recursion to miss
      mandatory chains during the flush, resulting in some of the
      topology missing from the synchronized flush.
      This bug could cause corruption due to a crash, but not due to
      a normal unmount, shutdown, or reboot, because that code always
      runs extra sync() calls which corrects the problem.
      Fix the bug by detecting that UPDATE was again set in the parent
      and run the RB_SCAN() again.
    * Fix an excessive stall that can occur in the XOP code due to a
      sleep/wakeup race.  This race could cause a VOP operation to stall
      for 60 seconds (it then hit some failsafe code and continued running
      Fix this issue by removing hamemr2_xop_head->check_counter and
      integrating its flagging functions into run_mask.  Increase run_mask
      to 64 bits to accomodate the counter in the upper 32 bits.
    * Optimize hammer2_inode_run_sideq().  Avoid running the sideq if the
      number of detached inodes is not significant, except when flushing
      in which case we always want to run the entire sideq.

Summary of changes:
 sys/vfs/hammer2/hammer2.h        | 25 ++++++------
 sys/vfs/hammer2/hammer2_admin.c  | 87 +++++++++++++++++++++++++---------------
 sys/vfs/hammer2/hammer2_chain.c  |  2 +-
 sys/vfs/hammer2/hammer2_flush.c  | 18 ++++++---
 sys/vfs/hammer2/hammer2_inode.c  | 30 +++++++++++++-
 sys/vfs/hammer2/hammer2_vfsops.c |  2 +-
 sys/vfs/hammer2/hammer2_vnops.c  |  7 ++--
 7 files changed, 116 insertions(+), 55 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list