From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 044DFC433F5 for ; Sun, 28 Nov 2021 11:42:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357241AbhK1LqK (ORCPT ); Sun, 28 Nov 2021 06:46:10 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34422 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234042AbhK1LoK (ORCPT ); Sun, 28 Nov 2021 06:44:10 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7248360C95 for ; Sun, 28 Nov 2021 11:40:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 542EFC004E1; Sun, 28 Nov 2021 11:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1638099653; bh=EhXVJIGIW8GW3xZxp6oy/q65ZmF86erAUOyz0uT+pkE=; h=Subject:To:Cc:From:Date:From; b=WZq5qBDlfHY1GxWVjC01epxq+Q3YwbSRd2PNkb18FOEE3EMkG40sSthAPICDkAJdO Dt4JGm45AnZ9UyxeB+fxei65YZhyj8a8CRtaYMVeEUA47BPdA5hoKfn0kzcvBfQCUq aFF1MYH6FXEjvRq2rWbh74031nIB+91Ysv3MgtXg= Subject: FAILED: patch "[PATCH] NFSv42: Fix pagecache invalidation after COPY/CLONE" failed to apply to 4.14-stable tree To: bcodding@redhat.com, stable@vger.kernel.org, trond.myklebust@hammerspace.com Cc: From: Date: Sun, 28 Nov 2021 12:40:40 +0100 Message-ID: <1638099640163156@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.14-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 3f015d89a47cd8855cd92f71fff770095bd885a1 Mon Sep 17 00:00:00 2001 From: Benjamin Coddington Date: Tue, 16 Nov 2021 10:48:13 -0500 Subject: [PATCH] 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: # v4.7+ Fixes: 2e72448b07dc ("NFS: Add COPY nfs operation") Signed-off-by: Benjamin Coddington Signed-off-by: Trond Myklebust diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c index 08355b66e7cb..8b21ff1be717 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c @@ -289,7 +289,9 @@ static void nfs42_copy_dest_done(struct inode *inode, loff_t pos, loff_t len) loff_t newsize = pos + len; loff_t end = newsize - 1; - truncate_pagecache_range(inode, pos, end); + WARN_ON_ONCE(invalidate_inode_pages2_range(inode->i_mapping, + pos >> PAGE_SHIFT, end >> PAGE_SHIFT)); + spin_lock(&inode->i_lock); if (newsize > i_size_read(inode)) i_size_write(inode, newsize);