git: hammer - Try to fix improper DATA CRC error

Matthew Dillon dillon at
Sat Jul 23 19:54:47 PDT 2016

commit e405f42bc0c0adfa19d17497c3222c73accafda9
Author: Matthew Dillon <dillon at>
Date:   Sat Jul 23 19:09:26 2016 -0700

    hammer - Try to fix improper DATA CRC error
    * Under heavy I/O loads HAMMER has an optimization (similar to UFS) where
      the logical buffer is used to issue a write to the underlying device,
      rather than copying the logical buffer to a device buffer.  This
      optmization is earmarked by a hammer2_record.
    * If the logical buffer is discarded just after it is written, and then
      re-read, hammer may go through a path which calls
      hammer_ip_resolve_data().  This code failed to check whether the record
      was still in-progress, and in-fact the write to the device may not have
      even been initiated yet, and there could also have been a device buffer
      alias in the buffer cache for the device for the offset.
      This caused the followup read to access the wrong data, causing HAMMER
      to report a DATA CRC error.  The actual media receives the correct data
      eventually and a umount/remount would show an uncorrupted file.
    * Try to fix the problem by calling hammer_io_direct_wait() on the record
      in this path to wait for the operation to complete (and also to
      invalidate the related device buffer) before trying to re-read the block
      from the media.

Summary of changes:
 sys/vfs/hammer/hammer_object.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list