From nobody Thu Feb 5 19:55:43 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4f6SdC4WtRz6R6bL for ; Thu, 05 Feb 2026 19:55:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4f6SdC35hRz4LDD for ; Thu, 05 Feb 2026 19:55:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770321343; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dRWuBWDf+IAA7mGoO5vTUJ4NDYv2dt7u5sjK55onl/U=; b=kAUvt9TrMesTbL1KkMRsolQ4OBmZ8EHhDdt0ZsYNA1pWwfXrM/+PGw9YtsWZTJfrqkddov OIfbFsM8w9wFdol0ZKTWSDLgUPb2iJ38PT128N+XdXxaoGFTDfM13FG3kXhP8xsiJm/AcG NRcnOomBIRJGDYsz+i9QiDHiKiD3dygyqyCftohvq7O5KXpZ4fH2+jtdhR5MXjzcCOv212 JWTA/rdYqIBnQ8s2AbA3U5SnuGqI1i4jELNTuNDSxDxAecQKsnszIjOFrAnsdDipMnV2bs 0SZZaItAcRVinsr/PY9Hj4CM3IE9N3hc5H8zrQ31OPZ6x1FaMm0KTiFBiZ88Xw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1770321343; a=rsa-sha256; cv=none; b=UCXVZr2F+rCVgiBk9appMlApuU/wUhPTy6q9rkXnEWF+HRqCItv+ALXiWM7TCwkCcqPXOv 0cXjYBIDkT8r4XOjz/bfexiwHl+SEk1BkGKGD6tlNnAOgtFOGr+ra1TfJROZ77IR9q3sYK U7ZQC0jZABR0rvN/2RNAXNUNUEms00rNUJQC+J+VMif9etzCZax2mA6HKg+JCPjgc1OLpy bWT0QDiuq7XwCW012FV3Di36KSGscl1lRcfeF3oLAJrUTWhiQkTNGXlHWA/ZkG8n5M4ZFX PX9I3cM6zg8SGvnKM5qQ13rmpcCR9ucjfLeizpk9a/7DNQyxWFBflIoPSUTF1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770321343; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dRWuBWDf+IAA7mGoO5vTUJ4NDYv2dt7u5sjK55onl/U=; b=qC0TZO+A0rEDcJwVsz9Jomse7TQyh4IProe0q47YlZsWSvJ/inq7fVpVWRrdwk7rY3vNEp dpt6W2KX5YVrkpCj9zdrLlAy3ByVjUOfFucryqsr1cRyNC+R+O6VnPWT+sB/K5LNjzR5yJ rMlnACWdUW8D2N7w8hw0Lsrzwn9+OL3EBiYDN5M1/ZCI2Hb0JZx+tHio9mcKs+W30intCb rDoCxZlb7xmV2wdSrqxgRkq+mT0tukVvMkpVSgTA6GHWuvF+XK6srBDfYs1CI3WsNPmtLW 2NKLUIhaQ7Gm5CMFQA05YH19jLR5SNxYd2p1ybjjjj1TeB5WXDkvmdbPtUqy1A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4f6SdC2VH1zl19 for ; Thu, 05 Feb 2026 19:55:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3dfc0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 05 Feb 2026 19:55:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 406c98d2ca1d - stable/15 - nfscl: Fix handling of case insensitive file systems List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 406c98d2ca1de620973446034bf487cd47e78598 Auto-Submitted: auto-generated Date: Thu, 05 Feb 2026 19:55:43 +0000 Message-Id: <6984f5bf.3dfc0.3deb31dd@gitrepo.freebsd.org> The branch stable/15 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=406c98d2ca1de620973446034bf487cd47e78598 commit 406c98d2ca1de620973446034bf487cd47e78598 Author: Rick Macklem AuthorDate: 2026-01-21 00:21:52 +0000 Commit: Rick Macklem CommitDate: 2026-02-05 19:53:58 +0000 nfscl: Fix handling of case insensitive file systems Name caching must be handled somewhat differently for case insensitive file systems. Negative name caching does not work and, for rename, all names associated with the rename'd vnode must be disabled. For a case insensitive ZFS file system that is exported, the unpatched code did work, since the change in mtime or ctime of the directory when other case names were created or rename'd would disable the false name cache hit. However, an export of an msdosfs file system breaks the NFS client, because it only works if ctime/mtime is changed whenever a name is added/removed. Depending on what the server file system is, this may not happen, due to clock resolution or lack of support for these attributes. This patch checks to see if the server file system is case insensitive and modifies the name caching to handle this. There is still a problem if a case insensitive file system is a subtree of a non-case insensitive is exported by the NFSv4 server. This can be fixed someday, when the NFSv4 client gets support for submounts within the mount. (cherry picked from commit f2155a6fb5681c3dca4524a3b2b862a72218a541) --- sys/fs/nfs/nfsport.h | 2 ++ sys/fs/nfsclient/nfs_clrpcops.c | 19 ++++++++++++++++--- sys/fs/nfsclient/nfs_clvnops.c | 12 +++++++++++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h index 4e9aae70da6f..f6b6cfb22908 100644 --- a/sys/fs/nfs/nfsport.h +++ b/sys/fs/nfs/nfsport.h @@ -1040,6 +1040,7 @@ void ncl_copy_vattr(struct vnode *vp, struct vattr *dst, struct vattr *src); #define NFSSTA_HASWRITEVERF 0x00040000 /* Has write verifier */ #define NFSSTA_GOTFSINFO 0x00100000 /* Got the fsinfo */ #define NFSSTA_OPENMODE 0x00200000 /* Must use correct open mode */ +#define NFSSTA_CASEINSENSITIVE 0x00400000 /* Case insensitive fs */ #define NFSSTA_FLEXFILE 0x00800000 /* Use Flex File Layout */ #define NFSSTA_NOLAYOUTCOMMIT 0x04000000 /* Don't do LayoutCommit */ #define NFSSTA_SESSPERSIST 0x08000000 /* Has a persistent session */ @@ -1073,6 +1074,7 @@ void ncl_copy_vattr(struct vnode *vp, struct vattr *dst, struct vattr *src); #define NFSHASPNFS(n) ((n)->nm_state & NFSSTA_PNFS) #define NFSHASFLEXFILE(n) ((n)->nm_state & NFSSTA_FLEXFILE) #define NFSHASOPENMODE(n) ((n)->nm_state & NFSSTA_OPENMODE) +#define NFSHASCASEINSENSITIVE(n) ((n)->nm_state & NFSSTA_CASEINSENSITIVE) #define NFSHASONEOPENOWN(n) (((n)->nm_flag & NFSMNT_ONEOPENOWN) != 0 && \ (n)->nm_minorvers > 0) #define NFSHASTLS(n) (((n)->nm_newflag & NFSMNT_TLS) != 0) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 9bdc2b776575..a0423ab23111 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -4995,11 +4995,13 @@ nfsrpc_statfs(vnode_t vp, struct nfsstatfs *sbp, struct nfsfsinfo *fsp, uint32_t *leasep, uint32_t *cloneblksizep, struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp) { + struct nfsvattr na; + struct nfsv3_pathconf pc; u_int32_t *tl = NULL; struct nfsrv_descript nfsd, *nd = &nfsd; struct nfsmount *nmp; nfsattrbit_t attrbits; - int error; + int attrflag, error; *attrflagp = 0; if (cloneblksizep != NULL) @@ -5066,6 +5068,15 @@ nfsrpc_statfs(vnode_t vp, struct nfsstatfs *sbp, struct nfsfsinfo *fsp, sbp->sf_bfree = fxdr_unsigned(u_int32_t, *tl++); sbp->sf_bavail = fxdr_unsigned(u_int32_t, *tl); } + + /* Try and find out if the server fs is case-insensitive. */ + error = nfsrpc_pathconf(vp, &pc, NULL, NULL, cred, p, &na, &attrflag); + if (error == 0 && pc.pc_caseinsensitive != 0) { + NFSLOCKMNT(nmp); + nmp->nm_state |= NFSSTA_CASEINSENSITIVE; + NFSUNLOCKMNT(nmp); + } + error = 0; nfsmout: m_freem(nd->nd_mrep); return (error); @@ -5086,9 +5097,11 @@ nfsrpc_pathconf(vnode_t vp, struct nfsv3_pathconf *pc, bool *has_namedattrp, int error; struct nfsnode *np; - *has_namedattrp = false; + if (has_namedattrp != NULL) + *has_namedattrp = false; *attrflagp = 0; - *clone_blksizep = 0; + if (clone_blksizep != NULL) + *clone_blksizep = 0; nmp = VFSTONFS(vp->v_mount); if (NFSHASNFSV4(nmp)) { np = VTONFS(vp); diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 7ecd1619a0ad..0d54b869d74c 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -1492,7 +1492,8 @@ handle_error: return (EJUSTRETURN); } - if ((cnp->cn_flags & MAKEENTRY) != 0 && dattrflag) { + if ((cnp->cn_flags & MAKEENTRY) != 0 && dattrflag && + !NFSHASCASEINSENSITIVE(nmp)) { /* * Cache the modification time of the parent * directory from the post-op attributes in @@ -2205,6 +2206,14 @@ nfs_rename(struct vop_rename_args *ap) if ((error = NFSVOPLOCK(fvp, LK_EXCLUSIVE)) != 0) goto out; + /* + * For case insensitive file systems, there may be multiple + * names cached for the one name being rename'd, so purge + * all names from the cache. + */ + if (NFSHASCASEINSENSITIVE(nmp)) + cache_purge(fvp); + /* * We have to flush B_DELWRI data prior to renaming * the file. If we don't, the delayed-write buffers @@ -2221,6 +2230,7 @@ nfs_rename(struct vop_rename_args *ap) if ((nmp->nm_flag & NFSMNT_NOCTO) == 0 || !NFSHASNFSV4(nmp) || !NFSHASNFSV4N(nmp) || nfscl_mustflush(fvp) != 0) error = VOP_FSYNC(fvp, MNT_WAIT, curthread); + NFSVOPUNLOCK(fvp); if (error == 0 && tvp != NULL && ((nmp->nm_flag & NFSMNT_NOCTO) == 0 || !NFSHASNFSV4(nmp) || !NFSHASNFSV4N(nmp) ||