]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - rpmsg/rpmsg.git/commit
xfs: fix data corruption w/ unaligned dedupe ranges
authorDave Chinner <dchinner@redhat.com>
Sat, 6 Oct 2018 01:44:19 +0000 (11:44 +1000)
committerDave Chinner <david@fromorbit.com>
Sat, 6 Oct 2018 01:44:19 +0000 (11:44 +1000)
commitdceeb47b0ed65e14de53507a8a9c32a90831cfa1
treea7f1a07a5d322830639a3406723b118bfd3f6cd3
parent7debbf015f580693680f3d2a3cef0cf99dcef688
xfs: fix data corruption w/ unaligned dedupe ranges

A deduplication data corruption is Exposed by fstests generic/505 on
XFS. It is caused by extending the block match range to include the
partial EOF block, but then allowing unknown data beyond EOF to be
considered a "match" to data in the destination file because the
comparison is only made to the end of the source file. This corrupts
the destination file when the source extent is shared with it.

XFS only supports whole block dedupe, but we still need to appear to
support whole file dedupe correctly.  Hence if the dedupe request
includes the last block of the souce file, don't include it in the
actual XFS dedupe operation. If the rest of the range dedupes
successfully, then report the partial last block as deduped, too, so
that userspace sees it as a successful dedupe rather than return
EINVAL because we can't dedupe unaligned blocks.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_reflink.c