From: Chuck Lever Date: Fri, 15 May 2026 15:35:11 +0000 (-0400) Subject: nfs: Skip pathconf probe when neither field is consumed X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=425294293cd11a05e46278c21cc674780e02fef1;p=thirdparty%2Flinux.git nfs: Skip pathconf probe when neither field is consumed 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 Closes: https://sashiko.dev/#/patchset/20260507-case-sensitivity-v14-0-e62cc8200435@oracle.com?part=10 Signed-off-by: Chuck Lever Link: https://patch.msgid.link/20260515153515.362266-4-cel@kernel.org Signed-off-by: Christian Brauner --- diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 28b66bb0dd337..73b95318ba48b 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; - - 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; + 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; + } + } 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 &&