git: DragonFly_RELEASE_5_8 hammer2 - Fix serious de-duplication bug and a few other things

Matthew Dillon dillon at
Thu Apr 23 19:03:55 PDT 2020

commit c41d6deadc7a5f0c2fb8cc6f2b8ad7db230db467
Author: Matthew Dillon <dillon at>
Date:   Thu Apr 23 17:38:10 2020 -0700

    hammer2 - Fix serious de-duplication bug and a few other things
    * Fix a serious de-duplication bug.  When small files <= 512
      bytes are extended with write()s to being larger than 512 bytes,
      it triggers a de-duplication bug in the first block of the file
      if that block can be de-duplicated from other sources.
      A mishandled skip condition combined with modest buffer cache
      flush loads can cause this first block can wind up getting
      zero'd out and cause a CHECK failure (I/O error) on the file.
      The fixes for this are primarily in hammer2_chain_modify().
    * Replace HAMMER2_BREF_FLAG_ZERO in the bref.flags with
      HAMMER2_CHAIN_NOTTESTED in the chain structure and deprecate
      the flag.  This flag could sometimes accidentally be flushed
      to the media.
    * Clear HAMMER2_CHAIN_INITIAL in two strategy write paths
      that are not typically hit.  The flag is probably already
      clear at this point since hammer2_chain_modify() has likely
      already been called, but be sure.

Summary of changes:
 sys/vfs/hammer2/hammer2.h          |  2 +-
 sys/vfs/hammer2/hammer2_chain.c    | 57 +++++++++++++++++++++++++-------------
 sys/vfs/hammer2/hammer2_disk.h     |  2 +-
 sys/vfs/hammer2/hammer2_io.c       |  7 +++--
 sys/vfs/hammer2/hammer2_strategy.c |  8 ++++--
 5 files changed, 50 insertions(+), 26 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list