Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2232081/?format=api
{ "id": 2232081, "url": "http://patchwork.ozlabs.org/api/patches/2232081/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260502-case-sensitivity-v13-13-aa853140311f@oracle.com/", "project": { "id": 12, "url": "http://patchwork.ozlabs.org/api/projects/12/?format=api", "name": "Linux CIFS Client", "link_name": "linux-cifs-client", "list_id": "linux-cifs.vger.kernel.org", "list_email": "linux-cifs@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260502-case-sensitivity-v13-13-aa853140311f@oracle.com>", "list_archive_url": null, "date": "2026-05-02T14:20:58", "name": "[v13,13/15] nfsd: Report export case-folding via NFSv3 PATHCONF", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "c62f7e67568bf9a425a1ab7d4873d4e3eabb5b9b", "submitter": { "id": 86689, "url": "http://patchwork.ozlabs.org/api/people/86689/?format=api", "name": "Chuck Lever", "email": "cel@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260502-case-sensitivity-v13-13-aa853140311f@oracle.com/mbox/", "series": [ { "id": 502530, "url": "http://patchwork.ozlabs.org/api/series/502530/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=502530", "date": "2026-05-02T14:20:45", "name": "Exposing case folding behavior", "version": 13, "mbox": "http://patchwork.ozlabs.org/series/502530/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2232081/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2232081/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-cifs+bounces-11372-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-cifs@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=FNZllbqz;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-cifs+bounces-11372-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"FNZllbqz\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201" ], "Received": [ "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g79DP04mQz1yGq\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 03 May 2026 00:25:25 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 2077A30097DF\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 2 May 2026 14:22:31 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id B223333AD81;\n\tSat, 2 May 2026 14:22:30 +0000 (UTC)", "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D3602820AC;\n\tSat, 2 May 2026 14:22:30 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id DA7E2C2BCC7;\n\tSat, 2 May 2026 14:22:24 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777731750; cv=none;\n b=mEJeU0gNvOnXciOYtC+Xwau/6c0hgEuT3NkI1qGfnUNqdZDZ4Y1GqV2yWAyCgyn16bog5SdFogSzVzJRjbj28jWru4ARDD6fo40ZgWhoUDsJFKk6wD1mr7ptVCC2iHj/h/+1QEU1qx9as3tXu9TmBHrEzAotL8Up3GKttC71Bac=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777731750; c=relaxed/simple;\n\tbh=sdRAbA0hLtQN2RnAbozuOhOqbFqQox7bou91/njDoms=;\n\th=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:\n\t In-Reply-To:To:Cc;\n b=eqcfCMsS/OzneAQKZVPjKCrX5fBTbIA9li5g+3FqkcMfWuMpsGP0MCRR+SKbu6pQcm2LA90DYc0bIeYQIeqzk2MECblWrEE8Qr18GyBh/X9CwZQWVxuChOsGOnaSvQOZj1vLiiUiqr/48rG2SWKR1Q68YLB4pEGMR2MNaavzaM0=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=FNZllbqz; arc=none smtp.client-ip=10.30.226.201", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777731750;\n\tbh=sdRAbA0hLtQN2RnAbozuOhOqbFqQox7bou91/njDoms=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=FNZllbqzVoBbR0NGwnoBBjRU7xSequIG890TkXVb1EEiRLncFALEZe7JrhiR3J8e/\n\t cF1wqx1GS/EqMtVt3utsN9hY6yEE8XbSgJ6sQBgyx7Uw4OuL5jhTY1G7M/du+02oSe\n\t OCWHkHLG+erjA4/ggppUs6auQIvRTknjYqzFCZOxhXqMGCi/yi39DVM+u9grnXiOF+\n\t U/sRlcZX9iNagm9qlUL7amDa8glHU99q6SPpfTMMPCTfYGanAZkwlw7ia7BOzpvn5z\n\t nqdKBMXcXDFuOVVB1gmWmLOrJOcfdBq4zv0ltqACLoA8xozbu2NmPUCkGttcEybf0v\n\t 9CKsfOQHGkt5w==", "From": "Chuck Lever <cel@kernel.org>", "Date": "Sat, 02 May 2026 10:20:58 -0400", "Subject": "[PATCH v13 13/15] nfsd: Report export case-folding via NFSv3\n PATHCONF", "Precedence": "bulk", "X-Mailing-List": "linux-cifs@vger.kernel.org", "List-Id": "<linux-cifs.vger.kernel.org>", "List-Subscribe": "<mailto:linux-cifs+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-cifs+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260502-case-sensitivity-v13-13-aa853140311f@oracle.com>", "References": "<20260502-case-sensitivity-v13-0-aa853140311f@oracle.com>", "In-Reply-To": "<20260502-case-sensitivity-v13-0-aa853140311f@oracle.com>", "To": "Al Viro <viro@zeniv.linux.org.uk>,\n Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>", "Cc": "linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,\n linux-xfs@vger.kernel.org, linux-cifs@vger.kernel.org,\n linux-nfs@vger.kernel.org, linux-api@vger.kernel.org,\n linux-f2fs-devel@lists.sourceforge.net, hirofumi@mail.parknet.co.jp,\n linkinjeon@kernel.org, sj1557.seo@samsung.com, yuezhang.mo@sony.com,\n almaz.alexandrovich@paragon-software.com, slava@dubeyko.com,\n glaubitz@physik.fu-berlin.de, frank.li@vivo.com, tytso@mit.edu,\n adilger.kernel@dilger.ca, cem@kernel.org, sfrench@samba.org,\n pc@manguebit.org, ronniesahlberg@gmail.com, sprasad@microsoft.com,\n trondmy@kernel.org, anna@kernel.org, jaegeuk@kernel.org, chao@kernel.org,\n hansg@kernel.org, senozhatsky@chromium.org,\n Chuck Lever <chuck.lever@oracle.com>,\n Roland Mainz <roland.mainz@nrubsig.org>", "X-Mailer": "b4 0.16-dev", "X-Developer-Signature": "v=1; a=openpgp-sha256; l=8016;\n i=chuck.lever@oracle.com; h=from:subject:message-id;\n bh=gPgHxk6J/l08HbE/ArroIs8LMtbWr6iWpYFW4djvm3Q=;\n b=owEBbQKS/ZANAwAKATNqszNvZn+XAcsmYgBp9ghRQxUjJJQkvR+X7w7b6YrZQNg3OE28iDeC6\n mUj9RPXpwmJAjMEAAEKAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCafYIUQAKCRAzarMzb2Z/\n lxOxEACBWOesoo4+9RI1Cg2aP3tI9x6cOs/Zj6Ez6E85J1/5y+dXj9NnJJKO4/0VgsSSqogI6CZ\n nR35sTkyP/JvKojGnCj4qN9i1T+wSd/IYzdXH0SwgcjNhrmSys5LajScny0DTkLr8gIc91WQE+0\n GOE9ToI1jKW4GpM2PfZISNNATU79nepS/CgRUYaUZWBHfgYSJfg2cS/0xEFZhlY9BusmyrKzN2x\n MVmh4MLWkrD1Sq8V7hdfpwsjAholAjf7Dykk6ojNDbBhv2rsLRAOx/MSek+/mXzp38qR+Oc5nJ3\n 12Lm0YpYoCSCB48YPf5m8Ud4grsAEliKfhTKD5QUWOMO4OrTVPMLsKtXh1OBpd7XMbIfq2ni+1G\n vr6PWmie4yozJejru+TXS4+m21iIwI1e0asi3eA1JmGcoKnCSSaZQBSi4Wc7D8/q+WJszKb/jaX\n clZZblUEukmqNZfev1Bx+KhwFzmfZDnJUw7Oxom+i+fOqm9BRuUqfFfExvaqid1GO7eMz4yu7wn\n ejRVSRhhB1/5dcw6yqscukyMdOrw0oDwG0emMcmYRWRwiCf5C2eB0s/8GE+23d0bjZVQCfBkeQI\n P7hxi+Ble1sDnSesQT8/iyvk0hw0rTkFuq6n7lKa/2/dWgGKccUiel5sR2wJae4CQKSdVTkwgL9\n vXZg0c5a5WyhnNA==", "X-Developer-Key": "i=chuck.lever@oracle.com; a=openpgp;\n fpr=28B2E5B01286DF243CF23EFE336AB3336F667F97" }, "content": "From: Chuck Lever <chuck.lever@oracle.com>\n\nThe hard-coded MSDOS_SUPER_MAGIC check in nfsd3_proc_pathconf()\nonly recognizes FAT filesystems as case-insensitive. Modern\nfilesystems like F2FS, exFAT, and CIFS support case-insensitive\ndirectories, but NFSv3 clients cannot discover this capability.\n\nQuery the export's actual case behavior through ->fileattr_get\ninstead. This allows NFSv3 clients to correctly handle case\nsensitivity for any filesystem that implements the fileattr\ninterface. Filesystems without ->fileattr_get continue to report\nthe default POSIX behavior (case-sensitive, case-preserving).\n\nThis change depends on the earlier \"fat: Implement fileattr_get\nfor case sensitivity\" patch in this series, which ensures FAT\nfilesystems report their case behavior correctly via the\nfileattr interface.\n\nCase-folding is a per-directory property, so\nnfsd_get_case_info() queries the parent dentry for\nnon-directory filehandles. Three inherent corner cases follow:\na single-file export's parent lies outside the exported\nsubtree, so the LSM hook evaluates against an unexported\ndirectory; a disconnected dentry from fh_verify() has\nd_parent == itself, so the file's own attributes are reported\nuntil the dentry connects; and a hardlinked file resolves\nthrough the alias the dcache currently holds, so when the\ninode is linked into both case-folded and case-sensitive\ndirectories the reported value tracks whichever parent is\nactive. These limitations are not addressable without\nredefining the protocol attribute as per-parent rather than\nper-object.\n\nRFC 1813 restricts PATHCONF errors to NFS3ERR_STALE,\nNFS3ERR_BADHANDLE, and NFS3ERR_SERVERFAULT. When an LSM hook\ndenies the case-folding query on the parent, NFS3ERR_STALE is\nthe only correct mapping: NFS3ERR_SERVERFAULT misrepresents a\nworking server as broken, and NFS3ERR_BADHANDLE implies a\ndecoding failure that did not occur. A client purging the\nfilehandle on receipt is the desired outcome, since the server\nhas refused to read attributes through it. Substituting POSIX\ndefaults instead would let the same handle report\ncasefold=false now and casefold=true once policy permits,\nopening a silent name-collision window on case-insensitive\nexports.\n\nReviewed-by: Roland Mainz <roland.mainz@nrubsig.org>\nSigned-off-by: Chuck Lever <chuck.lever@oracle.com>\n---\n fs/nfsd/nfs3proc.c | 36 +++++++++++++++++++++------\n fs/nfsd/vfs.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++\n fs/nfsd/vfs.h | 3 +++\n fs/nfsd/xdr3.h | 4 +--\n 4 files changed, 105 insertions(+), 10 deletions(-)", "diff": "diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c\nindex 42adc5461db0..62ebc65b8af2 100644\n--- a/fs/nfsd/nfs3proc.c\n+++ b/fs/nfsd/nfs3proc.c\n@@ -710,23 +710,43 @@ nfsd3_proc_pathconf(struct svc_rqst *rqstp)\n \tresp->p_name_max = 255;\t\t/* at least */\n \tresp->p_no_trunc = 0;\n \tresp->p_chown_restricted = 1;\n-\tresp->p_case_insensitive = 0;\n-\tresp->p_case_preserving = 1;\n+\tresp->p_case_insensitive = false;\n+\tresp->p_case_preserving = true;\n \n \tresp->status = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP);\n \n \tif (resp->status == nfs_ok) {\n \t\tstruct super_block *sb = argp->fh.fh_dentry->d_sb;\n+\t\tint err;\n \n-\t\t/* Note that we don't care for remote fs's here */\n-\t\tswitch (sb->s_magic) {\n-\t\tcase EXT2_SUPER_MAGIC:\n+\t\tif (sb->s_magic == EXT2_SUPER_MAGIC) {\n \t\t\tresp->p_link_max = EXT2_LINK_MAX;\n \t\t\tresp->p_name_max = EXT2_NAME_LEN;\n+\t\t}\n+\n+\t\terr = nfsd_get_case_info(argp->fh.fh_dentry,\n+\t\t\t\t\t &resp->p_case_insensitive,\n+\t\t\t\t\t &resp->p_case_preserving);\n+\t\t/* \n+\t\t * RFC 1813 lists NFS3ERR_STALE, NFS3ERR_BADHANDLE, and\n+\t\t * NFS3ERR_SERVERFAULT as the only PATHCONF errors.\n+\t\t */\n+\t\tswitch (err) {\n+\t\tcase 0:\n+\t\tcase -EOPNOTSUPP:\n+\t\t\t/* Both arms leave the output booleans valid. */\n \t\t\tbreak;\n-\t\tcase MSDOS_SUPER_MAGIC:\n-\t\t\tresp->p_case_insensitive = 1;\n-\t\t\tresp->p_case_preserving = 0;\n+\t\tcase -EACCES:\n+\t\tcase -EPERM:\n+\t\t\t/*\n+\t\t\t * Policy denied the query. Report STALE so the\n+\t\t\t * handle is unusable without implying a server\n+\t\t\t * malfunction.\n+\t\t\t */\n+\t\t\tresp->status = nfserr_stale;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tresp->status = nfserr_serverfault;\n \t\t\tbreak;\n \t\t}\n \t}\ndiff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c\nindex eafdf7b7890f..4bd63d8efbf7 100644\n--- a/fs/nfsd/vfs.c\n+++ b/fs/nfsd/vfs.c\n@@ -32,6 +32,7 @@\n #include <linux/writeback.h>\n #include <linux/security.h>\n #include <linux/sunrpc/xdr.h>\n+#include <linux/fileattr.h>\n \n #include \"xdr3.h\"\n \n@@ -2891,3 +2892,74 @@ nfsd_permission(struct svc_cred *cred, struct svc_export *exp,\n \n \treturn err? nfserrno(err) : 0;\n }\n+\n+/**\n+ * nfsd_get_case_info - get case sensitivity info for a dentry\n+ * @dentry: dentry to query\n+ * @case_insensitive: set to true if the filesystem is case-insensitive\n+ * @case_preserving: set to true if the filesystem preserves case\n+ *\n+ * On casefold-capable filesystems the flag lives on the directory,\n+ * not on its entries, so for a non-directory @dentry the parent is\n+ * queried instead. A directory (including an export root, whose\n+ * parent lies outside the export) is queried as-is so its own\n+ * contents' lookup behavior is reported.\n+ *\n+ * When the filesystem does not expose case-folding state (no\n+ * ->fileattr_get, or the callback returns -EOPNOTSUPP /\n+ * -ENOIOCTLCMD / -ENOTTY / -EINVAL), the outputs are filled with\n+ * POSIX defaults (case-sensitive, case-preserving) on the premise\n+ * that a filesystem with case-folding support wires up\n+ * fileattr_get.\n+ *\n+ * Other errors propagate unmodified (-EACCES, -EPERM from LSM\n+ * hooks; -EIO, -ESTALE, ... from the filesystem). Case-folding\n+ * behavior is a property of the exported filesystem, not of the\n+ * caller's credentials, so silently substituting defaults would\n+ * let the same dentry report POSIX while LSM denies and report\n+ * casefolding once LSM allows -- a client could race against\n+ * silent name collisions on a case-insensitive export.\n+ *\n+ * Return: 0 with outputs filled, -EOPNOTSUPP with outputs filled\n+ * to POSIX defaults, or a negative errno with outputs\n+ * unmodified.\n+ */\n+int\n+nfsd_get_case_info(struct dentry *dentry, bool *case_insensitive,\n+\t\t bool *case_preserving)\n+{\n+\tstruct file_kattr fa = {};\n+\tstruct dentry *cd;\n+\tbool put = false;\n+\tint err;\n+\n+\tif (d_is_dir(dentry)) {\n+\t\tcd = dentry;\n+\t} else {\n+\t\tcd = dget_parent(dentry);\n+\t\tput = true;\n+\t}\n+\terr = vfs_fileattr_get(cd, &fa);\n+\tif (put)\n+\t\tdput(cd);\n+\tswitch (err) {\n+\tcase 0:\n+\t\t*case_insensitive = fa.fsx_xflags & FS_XFLAG_CASEFOLD;\n+\t\t*case_preserving =\n+\t\t\t!(fa.fsx_xflags & FS_XFLAG_CASENONPRESERVING);\n+\t\treturn 0;\n+\tcase -EINVAL:\n+\tcase -ENOTTY:\n+\tcase -ENOIOCTLCMD:\n+\tcase -EOPNOTSUPP:\n+\t\t/*\n+\t\t * Filesystem does not expose case state.\n+\t\t * Report POSIX defaults.\n+\t\t */\n+\t\t*case_insensitive = false;\n+\t\t*case_preserving = true;\n+\t\treturn -EOPNOTSUPP;\n+\tdefault:\n+\t\treturn err;\n+\t}\n+}\ndiff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h\nindex 702a844f2106..e09ea04a51b9 100644\n--- a/fs/nfsd/vfs.h\n+++ b/fs/nfsd/vfs.h\n@@ -156,6 +156,9 @@ __be32\t\tnfsd_readdir(struct svc_rqst *, struct svc_fh *,\n \t\t\t loff_t *, struct readdir_cd *, nfsd_filldir_t);\n __be32\t\tnfsd_statfs(struct svc_rqst *, struct svc_fh *,\n \t\t\t\tstruct kstatfs *, int access);\n+int\t\tnfsd_get_case_info(struct dentry *dentry,\n+\t\t\t\t bool *case_insensitive,\n+\t\t\t\t bool *case_preserving);\n \n __be32\t\tnfsd_permission(struct svc_cred *cred, struct svc_export *exp,\n \t\t\t\tstruct dentry *dentry, int acc);\ndiff --git a/fs/nfsd/xdr3.h b/fs/nfsd/xdr3.h\nindex 522067b7fd75..a7c9714b0b0e 100644\n--- a/fs/nfsd/xdr3.h\n+++ b/fs/nfsd/xdr3.h\n@@ -209,8 +209,8 @@ struct nfsd3_pathconfres {\n \t__u32\t\t\tp_name_max;\n \t__u32\t\t\tp_no_trunc;\n \t__u32\t\t\tp_chown_restricted;\n-\t__u32\t\t\tp_case_insensitive;\n-\t__u32\t\t\tp_case_preserving;\n+\tbool\t\t\tp_case_insensitive;\n+\tbool\t\t\tp_case_preserving;\n };\n \n struct nfsd3_commitres {\n", "prefixes": [ "v13", "13/15" ] }