]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: remove dest file's post-eof preallocations before reflinking
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 11 Dec 2017 02:03:54 +0000 (18:03 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 14 Dec 2017 17:20:11 +0000 (09:20 -0800)
commite61ab41a3d2acaede03a1f6264c1b197d3625b43
tree6b727eabcb415cb66e64dc48ba4ae0887cddc2e7
parent17f1114077228ef7261bbbf68432812bdc9bb0ad
xfs: remove dest file's post-eof preallocations before reflinking

If we try to reflink into a file with post-eof preallocations at an
offset well past the preallocations, we increase i_size as one would
expect.  However, those allocations do not have page cache backing them,
so they won't get cleaned out on their own.  This leads to asserts in
the collapse/insert range code and xfs_destroy_inode when they encounter
delalloc extents they weren't expecting to find.

Since there are plenty of other places where we dump those post-eof
blocks, do the same to the reflink destination file before we start
remapping extents.  This was found by adding clonerange support to
fsstress and running it in write-only mode.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_reflink.c