Linux filesystem development
 help / color / mirror / Atom feed
From: Chuck Lever <cel@kernel.org>
To: Christian Brauner <brauner@kernel.org>
Cc: <linux-fsdevel@vger.kernel.org>,
	Chuck Lever <chuck.lever@oracle.com>,
	sashiko-bot <sashiko-bot@kernel.org>
Subject: [PATCH 3/7] nfs: Skip pathconf probe when neither field is consumed
Date: Fri, 15 May 2026 11:35:11 -0400	[thread overview]
Message-ID: <20260515153515.362266-4-cel@kernel.org> (raw)
In-Reply-To: <20260515153515.362266-1-cel@kernel.org>

From: Chuck Lever <chuck.lever@oracle.com>

The PATHCONF RPC issued from nfs_probe_fsinfo() supplies two pieces of
information: max_namelen, used only when server->namelen has not been
pinned by mount options, and the case_insensitive / case_preserving
fields, used only by the NFSv2/NFSv3 path. NFSv4 receives its case
sensitivity caps from the FATTR4_CASE_* attributes during the
set_capabilities probe, and a non-zero server->namelen short-circuits
the only other field of interest.

When both conditions hold (NFSv4 with namelen pinned), the pathconf
reply is discarded in full but the round-trip is still on the mount
critical path. Gate the call on version < 4 || namelen == 0 so that
mounts which cannot benefit from the reply do not pay for it.

Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260507-case-sensitivity-v14-0-e62cc8200435@oracle.com?part=10
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfs/client.c | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 28b66bb0dd33..73b95318ba48 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -937,23 +937,25 @@ static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, str
 	pathinfo.fattr = fattr;
 	nfs_fattr_init(fattr);
 
-	if (clp->rpc_ops->pathconf(server, mntfh, &pathinfo) >= 0) {
-		if (server->namelen == 0)
-			server->namelen = pathinfo.max_namelen;
-		if (clp->rpc_ops->version < 4) {
-			unsigned int caps = server->caps;
+	if (clp->rpc_ops->version < 4 || server->namelen == 0) {
+		if (clp->rpc_ops->pathconf(server, mntfh, &pathinfo) >= 0) {
+			if (server->namelen == 0)
+				server->namelen = pathinfo.max_namelen;
+			if (clp->rpc_ops->version < 4) {
+				unsigned int caps = server->caps;
 
-			caps &= ~(NFS_CAP_CASE_INSENSITIVE |
-				  NFS_CAP_CASE_NONPRESERVING);
-			if (pathinfo.case_insensitive)
-				caps |= NFS_CAP_CASE_INSENSITIVE;
-			if (!pathinfo.case_preserving)
-				caps |= NFS_CAP_CASE_NONPRESERVING;
-			server->caps = caps;
+				caps &= ~(NFS_CAP_CASE_INSENSITIVE |
+					  NFS_CAP_CASE_NONPRESERVING);
+				if (pathinfo.case_insensitive)
+					caps |= NFS_CAP_CASE_INSENSITIVE;
+				if (!pathinfo.case_preserving)
+					caps |= NFS_CAP_CASE_NONPRESERVING;
+				server->caps = caps;
+			}
+		} else if (clp->rpc_ops->version < 4) {
+			server->caps &= ~(NFS_CAP_CASE_INSENSITIVE |
+					  NFS_CAP_CASE_NONPRESERVING);
 		}
-	} else if (clp->rpc_ops->version < 4) {
-		server->caps &= ~(NFS_CAP_CASE_INSENSITIVE |
-				  NFS_CAP_CASE_NONPRESERVING);
 	}
 
 	if (clp->rpc_ops->discover_trunking != NULL &&
-- 
2.54.0


  parent reply	other threads:[~2026-05-15 15:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15 15:35 [PATCH 0/7] Fixes for vfs/vfs-7.2.casefold Chuck Lever
2026-05-15 15:35 ` [PATCH 1/7] tools headers UAPI: Sync case-sensitivity flags from linux/fs.h Chuck Lever
2026-05-15 15:35 ` [PATCH 2/7] nfs: Avoid transient zeroed case capability bits during probe Chuck Lever
2026-05-15 15:35 ` Chuck Lever [this message]
2026-05-15 15:35 ` [PATCH 4/7] fs: Clarify FS_CASEFOLD_FL semantics in UAPI header Chuck Lever
2026-05-15 15:35 ` [PATCH 5/7] nfsd: Use kernel credentials for case-info probe Chuck Lever
2026-05-15 15:35 ` [PATCH 6/7] nfsd: Map -ESTALE from case probe to NFS3ERR_STALE Chuck Lever
2026-05-15 15:35 ` [PATCH 7/7] nfsd: Cap case-folding probe cost across READDIR entries Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260515153515.362266-4-cel@kernel.org \
    --to=cel@kernel.org \
    --cc=brauner@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sashiko-bot@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox