Skip to content

Commit 3f015d8

Browse files
bcodding-rhTrond Myklebust
authored andcommitted
NFSv42: Fix pagecache invalidation after COPY/CLONE
The mechanism in use to allow the client to see the results of COPY/CLONE is to drop those pages from the pagecache. This forces the client to read those pages once more from the server. However, truncate_pagecache_range() zeros out partial pages instead of dropping them. Let us instead use invalidate_inode_pages2_range() with full-page offsets to ensure the client properly sees the results of COPY/CLONE operations. Cc: <stable@vger.kernel.org> # v4.7+ Fixes: 2e72448 ("NFS: Add COPY nfs operation") Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent 93c2e5e commit 3f015d8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎fs/nfs/nfs42proc.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,9 @@ static void nfs42_copy_dest_done(struct inode *inode, loff_t pos, loff_t len)
289289
loff_t newsize = pos + len;
290290
loff_t end = newsize - 1;
291291

292-
truncate_pagecache_range(inode, pos, end);
292+
WARN_ON_ONCE(invalidate_inode_pages2_range(inode->i_mapping,
293+
pos >> PAGE_SHIFT, end >> PAGE_SHIFT));
294+
293295
spin_lock(&inode->i_lock);
294296
if (newsize > i_size_read(inode))
295297
i_size_write(inode, newsize);

0 commit comments

Comments
 (0)