Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp312051pxf; Wed, 17 Mar 2021 06:04:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJ1ppb61+L+gbwSPYJi1z2i1Qwm7At5Z9lT7ELh9liOPj8XptLVMZj1Ea4yNqwf2AhZDG1 X-Received: by 2002:a05:6402:34d5:: with SMTP id w21mr20940214edc.14.1615986285584; Wed, 17 Mar 2021 06:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615986285; cv=none; d=google.com; s=arc-20160816; b=N7l059aMWppeeiiiVqIky3D3z37f1KZXAIRoqW2+PcO6A4zYOOpI47iYPqYrnSjay1 totbkHA/KAJnfe2k5PG+7g3OffiMYocJKd8OT0OR+EYjF2/6xpQmrlnPgPiMKIudHArY gzPTkm93MyR2QVSoyFJh04RfQ7g3mY0eRvwf34QvY85ZB3/hESP4vElQpvOcTon17Up0 12hMtL4kNqX7WbFIgyn0QOPWfY4tIuZzRxN+imnhmm0KEYoebU43aHzleviXd4UgHzec tdaOfUO66CU6aKjxEaskmAIhWQn/SbRSwIQjnHWK4eWAzLTlVgww6n9vobLO2gM6KCF6 YlyQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=1Z7UGUxJ8P3bcRpOfLQpgf/KU3FWujJdeAUDuRdI+qM=; b=Thnd5PjH7SoepQoCK7H3K+0LCTznYfW3keHH8IiYhUHk/9XPOmc6ZnIJTxnGDAQe2i twUqIFz09dO98zaeEpfmWXCiyC+qD/8aua4aQtW9kR5CJfgTb4NNLP1Zklax+xU68zS8 c02DRODKTIXCV2c/6IGZwDdoQ3PDhV100oQNCe4WpwnMCqHHFUu5ePyFxHswVQLpZhQ8 NiKn41PlriF+XtxREV/m8QYshPZ/vQDLy4kEuZRc8Fe7D6Xb6zakrE3Yy7ntwqd2hHKb 5PkX4EHGILtMODNwxwquimaNol6QtmLThi/3XVSnimBGdU9q/af3rS8DFC/h9RjG/qH5 ow3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=snZPwiC8; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r11si15891615ejy.571.2021.03.17.06.04.14; Wed, 17 Mar 2021 06:04:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@kernel.org header.s=k20201202 header.b=snZPwiC8; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229944AbhCQNB0 (ORCPT + 99 others); Wed, 17 Mar 2021 09:01:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:35070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230044AbhCQNBM (ORCPT ); Wed, 17 Mar 2021 09:01:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1C96F64E41; Wed, 17 Mar 2021 13:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615986072; bh=m0gnAiNhAkVhqUExZnTGjItJOz5/NZPMJSgKXlK/Jh0=; h=From:To:Cc:Subject:Date:From; b=snZPwiC8rzHVNm3q5snfqZXR9RlLfWf7joAf1GVzScAICW4/jF3I/6EkZx1auY7ij wOkSHV6nzJO+119o6Y+WsS1proPtc8YtOk3MkIy4Y0aW0HwtN9hqOe5zEWd54MQxSw W1iLY7VuzMCrz6dy0bfvwEpSonI8jnoIUqdPR0S6SOOeM8VoH+kLR1JDmBYiBiE6z0 4Sn0OxoiFBQvCE3DKyurMoWlNNjFBq+GCB2CqUrkID9IFUenkOJ/yA8UcMdQJ+Xyz5 OsSTkS5Y32uBh6wivxEtw4VWB+SSgQie91XQIf3nB9qWPBj+O8Ua5uDQfIKRahtYnu 9nXsEskZCggog== From: trondmy@kernel.org To: Nagendra S Tomar Cc: linux-nfs@vger.kernel.org Subject: [PATCH] NFS: Only change the cookie verifier if the directory page cache is empty Date: Wed, 17 Mar 2021 09:01:10 -0400 Message-Id: <20210317130110.1257066-1-trondmy@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust 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 --- 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