diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-10-30 00:43:16 +0100 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2018-10-30 00:43:16 +0100 |
commit | a8a94302c9754d05069ee149cf01df8aa5116aaa (patch) | |
tree | b7aade546f9fa43b095b6bd5f7d7dd50df3972ee /fs/ocfs2 | |
parent | ocfs2: truncate page cache for clone destination file before remapping (diff) | |
download | linux-a8a94302c9754d05069ee149cf01df8aa5116aaa.tar.xz linux-a8a94302c9754d05069ee149cf01df8aa5116aaa.zip |
ocfs2: fix pagecache truncation prior to reflink
Prior to remapping blocks, it is necessary to remove pages from the
destination file's page cache. Unfortunately, the truncation is not
aggressive enough -- if page size > block size, we'll end up zeroing
subpage blocks instead of removing them. So, round the start offset
down and the end offset up to page boundaries. We already wrote all
the dirty data so the larger range should be fine.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/refcounttree.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 2a5c96bc9677..7c709229e108 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c @@ -4862,8 +4862,9 @@ int ocfs2_reflink_remap_range(struct file *file_in, SINGLE_DEPTH_NESTING); /* Zap any page cache for the destination file's range. */ - truncate_inode_pages_range(&inode_out->i_data, pos_out, - PAGE_ALIGN(pos_out + len) - 1); + truncate_inode_pages_range(&inode_out->i_data, + round_down(pos_out, PAGE_SIZE), + round_up(pos_out + len, PAGE_SIZE) - 1); ret = ocfs2_reflink_remap_blocks(inode_in, in_bh, pos_in, inode_out, out_bh, pos_out, len); |