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.