Skip to content

Commit a0a7875

Browse files
bcodding-rhgregkh
authored andcommitted
NFSv42: Fix pagecache invalidation after COPY/CLONE
commit 3f015d8 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 55d2254 commit a0a7875

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
@@ -285,7 +285,9 @@ static void nfs42_copy_dest_done(struct inode *inode, loff_t pos, loff_t len)
285285
loff_t newsize = pos + len;
286286
loff_t end = newsize - 1;
287287

288-
truncate_pagecache_range(inode, pos, end);
288+
WARN_ON_ONCE(invalidate_inode_pages2_range(inode->i_mapping,
289+
pos >> PAGE_SHIFT, end >> PAGE_SHIFT));
290+
289291
spin_lock(&inode->i_lock);
290292
if (newsize > i_size_read(inode))
291293
i_size_write(inode, newsize);

0 commit comments

Comments
 (0)