Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3059022pxj; Mon, 17 May 2021 16:42:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwk88r4Kr48Io5axWiI8PYHQJ+Y7Hc5dlbhb69ceOFBrXfwPR0vud5ANNpjGdJoIFT8GZg0 X-Received: by 2002:a17:906:2559:: with SMTP id j25mr2645424ejb.42.1621294964945; Mon, 17 May 2021 16:42:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621294964; cv=none; d=google.com; s=arc-20160816; b=KCZ1hoMvUIVhqCpo2BboSw61o7IveYFUURAy2BvedlfmaN6QIrWWxwHj0CMmXfK6fX acgIDDQRrDSnHDJCYg3rRlOMWuytToWH8XT4YGs/0ablKw0cxgqWMUY6dZd0KB+f5Gxg rQM8fANXWAxdwZUk2Rue+CdRCCYe09SNAqN3Au+poWWDFO59aJUrDkqFBXGbi7F/saMx M3UXYKoKr2go9uul0VyJfvXCyQclVRHOil4WDAYHYWJIeU9K/wIeiiGoGQ7Z/prBj1cj n1A7K6QqEyiwa93UYb2CabwY6aV7kq3BCxfT1FRMRPumxnNVh43GtBHHBV2TWQLbCQ+0 8CHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Agh0FhtNmy3iBRDWQna59cS2FmjbZAkOgq40l3Eu0NE=; b=x5OYGlw0AgFjr+8duSsDLyDY0TzNanuIYf0/Xorero0YFJXv/YHI6I/U/OswWey/zb 4nUs2nm2BbqE05w8f6XfOf3YydDotT2pdA/mvFof0e7zrWHxqU4ddkfo6aNDVKCdb+x3 AScd3rdJlzD0ssF3ykvqyIvMVG+VrbboQ4XyPubGTPyzpEC6YFnqIg6Ra3CZE4MylCqR ScoSMA/ajjOd6TlZTrQn0xWk9vAEJ+RqZAaWCY0AtK8Tk+C5MQ6opvj879nsRyXgJT7m 5F6vGBv43LNuEQGwNUv0hzAUoguOyCGgn/Md7TlcdFFOGu7e5mB6yWDvpWho24Vb2Jkr vPsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dYsNpKXH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si18889829ejb.398.2021.05.17.16.42.22; Mon, 17 May 2021 16:42:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dYsNpKXH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239296AbhEQOXO (ORCPT + 99 others); Mon, 17 May 2021 10:23:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:38294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239324AbhEQOTb (ORCPT ); Mon, 17 May 2021 10:19:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AE84A613B9; Mon, 17 May 2021 14:10:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260660; bh=+vQ7GaDBS37A4+b6pqKMSGtMBefdnqmSi+qZP4C4x2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dYsNpKXH7yGhGcfAS89NlL+BmdfsHkCRG5X/P32uT1+q39H+WapfsYo7qPmagT6wc ++WkZsgNq9KfweT3/m0oJSNUomfcgGNyPn/NrpK82wrYyooRh30Y09a4Eoucau0ebu 90g0Z7G8A8dOqt8tThIT7QieVVbKtgR7e1o0v/W0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Sasha Levin Subject: [PATCH 5.12 147/363] NFS: Only change the cookie verifier if the directory page cache is empty Date: Mon, 17 May 2021 16:00:13 +0200 Message-Id: <20210517140307.584151619@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Trond Myklebust [ Upstream commit f892c41c14e0fa3d78ce37de1d5c8161ed13bf08 ] The cached NFSv3/v4 readdir cookies are associated with a verifier, which is checked by the server on subsequent calls to readdir, and is only expected to change when the cookies (and hence also the page cache contents) are considered invalid. We therefore do have to store the verifier, but only when the page cache is empty. Fixes: b593c09f83a2 ("NFS: Improve handling of directory verifiers") Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/dir.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 2cf2a7d92faf..0cd7c59a6601 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -929,7 +929,12 @@ static int find_and_lock_cache_page(struct nfs_readdir_descriptor *desc) } return res; } - memcpy(nfsi->cookieverf, verf, sizeof(nfsi->cookieverf)); + /* + * Set the cookie verifier if the page cache was empty + */ + if (desc->page_index == 0) + memcpy(nfsi->cookieverf, verf, + sizeof(nfsi->cookieverf)); } res = nfs_readdir_search_array(desc); if (res == 0) { -- 2.30.2