generic: test reflinked file corruption after short COW
authorEric Sandeen <sandeen@redhat.com>
Thu, 8 Oct 2020 21:22:13 +0000 (16:22 -0500)
committerEryu Guan <guaneryu@gmail.com>
Sun, 11 Oct 2020 05:01:45 +0000 (13:01 +0800)
commitb3170bfe8da1cd9e2786ea71dc736bfc8e129b8d
treeec493a65f34fb1379080fb9e63caf5d5d8c8470e
parent5f35d3df8a14887a1a641fc8b0bb93dad2c78ae7
generic: test reflinked file corruption after short COW

This test essentially creates an existing COW extent which
covers the first 1M, and then does another IO that overlaps it,
but extends beyond it.  The bug was that we did not trim the
new IO to the end of the existing COW extent, and so the IO
extended past the COW blocks and corrupted the reflinked files(s).

The bug came and went upstream.  It was introduced by:

78f0cc9d55cb "xfs: don't use delalloc extents for COW on files with extsize hints"
and (inadvertently) fixed as of:
36adcbace24e "xfs: fill out the srcmap in iomap_begin"
upstream, and in the 5.4 stable tree with:
aee38af574a1 "xfs: trim IO to found COW extent limit"

[Eryu: discard outputs of xfs_io when setting [cow]extsize]

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/612 [new file with mode: 0755]
tests/generic/612.out [new file with mode: 0644]
tests/generic/group