Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2453931pxm; Sun, 27 Feb 2022 22:16:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwk9sl1GfxiCd1O7MeFhmgdjKDwgX6mtv5jBZ+dNUqgeZZQOlNnty7PAWsqwpacuvUvZ59W X-Received: by 2002:a17:902:e78c:b0:14f:98f5:2a62 with SMTP id cp12-20020a170902e78c00b0014f98f52a62mr18421445plb.118.1646028997136; Sun, 27 Feb 2022 22:16:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646028997; cv=none; d=google.com; s=arc-20160816; b=uLxBSPVVBbnnXoq1bvRPi9Pk32TGk24KG3Qt0wRXCxvevCYJfyNl3nJcNgXqOWimSA XAng50B/m0H3iu10A75q9lALb68SO9Qnb36QlOKKV+UelJuIDL3stHygse60zYnr5xRq 9/ZbF7m5x0DhTUWzT8Z/wL+yQeewTPVB4FNDZ93QbxMZcprAPYtXrwyF1NC9jwngUouc 81m8ZV8P6T0sYXHnQ1zp71h+75pY0VszXD/tsHGmQbYyggqqRbNObBSVIGrGU/ri0hEW kHSduPs4w5R8sOGEi5THsAQrnPDRWrSuE//OAy3l0FuHKYJjxd4Y7QO3vQ/DjCkcV72n HBSg== 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 :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Pkifu+AanNAROoiv2QXxooLuaVc2XEyVepgOsciZZqU=; b=mEuK7aT4Fu+5xw0FJ77uwND16BjO7qnpcfPfL4ZlJARxQN7ihKODsQXDoOFJQV34a3 g4l5+VV/tSCU1WlS2qAsGkYlztKb8zif2egdbH5duKot/HUeIufLYdeudHF2hYmA0msN H8Ufv0N33JZbIAeMy1/3ybmx9lA15+7Msj+FoQ0kRFw8sDdPNxq7wy2NsAsdVkrjI/eW jqcvyLo74dRDCo2W/IsgT5i9obggh9g+u4zfiEW2UtQiY1e6ffPS4d4D7IoJYgjgJuP4 cypyV9ys7F//+5Sk5Jva0c/FLkJ48SyregUH+6H04t8Mi7gLhRySTjnthzJRbmuY1hSi CCoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PTJU8o1G; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id in2-20020a17090b438200b001bc545e019dsi13604774pjb.90.2022.02.27.22.16.11; Sun, 27 Feb 2022 22:16:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PTJU8o1G; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232193AbiB0XTU (ORCPT + 99 others); Sun, 27 Feb 2022 18:19:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232204AbiB0XTS (ORCPT ); Sun, 27 Feb 2022 18:19:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4F8222505 for ; Sun, 27 Feb 2022 15:18:41 -0800 (PST) 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 3D9FB611D9 for ; Sun, 27 Feb 2022 23:18:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7BFDC340EE for ; Sun, 27 Feb 2022 23:18:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646003921; bh=cWdoEAxiyJbm8FK1n2ICqEmLe4AnnzqDZhR0Jrn3E2o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PTJU8o1GR//DKkNzTlZWG/MvObchiM+WOjvu1pGXWmGLdGRJb5LaR/ZDqZQRHJ+4M zfa6564+CVQoM5m8LZHAmeFam/nAkl5eRUHNvdRshBq54J81S1qJY5CLzgTW0/TuXj py+ovS97nbryGYgjf3vvBupJG7mkaN3XaM/mTxxn4Wqt6gQqjjZlKK/ymSho6zGv5w cvlDATUPEYERlZvpdIfISa1EtsyAgCvgqB0EVRQ8/uudBifXQulO1c7O1renS+Nywm m1Yk/SsHf6NO1cAKc3ivjrhXPwBhbWRocNLxvg5ZZCIq108im9ljg0z0IuQFLcBBqF u5rI579DZawiA== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH v9 18/27] NFS: Don't request readdirplus when revalidation was forced Date: Sun, 27 Feb 2022 18:12:18 -0500 Message-Id: <20220227231227.9038-19-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220227231227.9038-18-trondmy@kernel.org> References: <20220227231227.9038-1-trondmy@kernel.org> <20220227231227.9038-2-trondmy@kernel.org> <20220227231227.9038-3-trondmy@kernel.org> <20220227231227.9038-4-trondmy@kernel.org> <20220227231227.9038-5-trondmy@kernel.org> <20220227231227.9038-6-trondmy@kernel.org> <20220227231227.9038-7-trondmy@kernel.org> <20220227231227.9038-8-trondmy@kernel.org> <20220227231227.9038-9-trondmy@kernel.org> <20220227231227.9038-10-trondmy@kernel.org> <20220227231227.9038-11-trondmy@kernel.org> <20220227231227.9038-12-trondmy@kernel.org> <20220227231227.9038-13-trondmy@kernel.org> <20220227231227.9038-14-trondmy@kernel.org> <20220227231227.9038-15-trondmy@kernel.org> <20220227231227.9038-16-trondmy@kernel.org> <20220227231227.9038-17-trondmy@kernel.org> <20220227231227.9038-18-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust If the revalidation was forced, due to the presence of a LOOKUP_EXCL or a LOOKUP_REVAL flag, then readdirplus won't help. It also can't help when we're doing a path component lookup. Signed-off-by: Trond Myklebust --- fs/nfs/dir.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 5892c4ee3a6d..1da741dd2135 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -692,10 +692,13 @@ void nfs_readdir_record_entry_cache_miss(struct inode *dir) } } -static void nfs_lookup_advise_force_readdirplus(struct inode *dir) +static void nfs_lookup_advise_force_readdirplus(struct inode *dir, + unsigned int flags) { if (nfs_server_capable(dir, NFS_CAP_CASE_INSENSITIVE)) return; + if (flags & (LOOKUP_EXCL | LOOKUP_PARENT | LOOKUP_REVAL)) + return; nfs_readdir_record_entry_cache_miss(dir); } @@ -1594,15 +1597,17 @@ nfs_lookup_revalidate_delegated(struct inode *dir, struct dentry *dentry, return nfs_lookup_revalidate_done(dir, dentry, inode, 1); } -static int -nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry, - struct inode *inode) +static int nfs_lookup_revalidate_dentry(struct inode *dir, + struct dentry *dentry, + struct inode *inode, unsigned int flags) { struct nfs_fh *fhandle; struct nfs_fattr *fattr; unsigned long dir_verifier; int ret; + trace_nfs_lookup_revalidate_enter(dir, dentry, flags); + ret = -ENOMEM; fhandle = nfs_alloc_fhandle(); fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode)); @@ -1623,6 +1628,10 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry, } goto out; } + + /* Request help from readdirplus */ + nfs_lookup_advise_force_readdirplus(dir, flags); + ret = 0; if (nfs_compare_fh(NFS_FH(inode), fhandle)) goto out; @@ -1632,8 +1641,6 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry, nfs_setsecurity(inode, fattr); nfs_set_verifier(dentry, dir_verifier); - /* set a readdirplus hint that we had a cache miss */ - nfs_lookup_advise_force_readdirplus(dir); ret = 1; out: nfs_free_fattr(fattr); @@ -1699,8 +1706,7 @@ nfs_do_lookup_revalidate(struct inode *dir, struct dentry *dentry, if (NFS_STALE(inode)) goto out_bad; - trace_nfs_lookup_revalidate_enter(dir, dentry, flags); - return nfs_lookup_revalidate_dentry(dir, dentry, inode); + return nfs_lookup_revalidate_dentry(dir, dentry, inode, flags); out_valid: return nfs_lookup_revalidate_done(dir, dentry, inode, 1); out_bad: @@ -1894,7 +1900,7 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in goto out; /* Notify readdir to use READDIRPLUS */ - nfs_lookup_advise_force_readdirplus(dir); + nfs_lookup_advise_force_readdirplus(dir, flags); no_entry: res = d_splice_alias(inode, dentry); @@ -2157,7 +2163,7 @@ nfs4_do_lookup_revalidate(struct inode *dir, struct dentry *dentry, reval_dentry: if (flags & LOOKUP_RCU) return -ECHILD; - return nfs_lookup_revalidate_dentry(dir, dentry, inode); + return nfs_lookup_revalidate_dentry(dir, dentry, inode, flags); full_reval: return nfs_do_lookup_revalidate(dir, dentry, flags); -- 2.35.1