From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1CD623D2B2; Fri, 16 Jan 2026 14:46:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768574815; cv=none; b=uJ5hBDzzHCU1hXIz8/tad7V9DAVALanXdvCTtAstwlQGWx+ty+Juf4ZKtAB5CKurvNThTKoOWdr97XCCNJia74MaM2BylTz/jA6A+Pu/5fmJOXQ9+PEK6KDnUDi9GJ8TfRbQZW3dSR2YLVy5oggYU1k0aub6ehvLZ1dOn4smf64= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768574815; c=relaxed/simple; bh=AjApcZ4VYkMiShoCKJtmD6SizN9yB/T+ppsUzY4US+Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u/pWshXjfJqmNdLdEep7oioNSV2JtoO3QDi/z7RF4HS41Z9whSXCELOeBwwGSGfjTf3LIAmzJTwyWrFnO/VhuQARBbRIvC//lDHlf5yFZSsu/Bkd73nN9v+OLWntEtb7bY3q0cUuk7sk+pMw4KjY7QE1HPcKk0CQn9svuwIZOOU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r3zQUd+W; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="r3zQUd+W" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63E14C16AAE; Fri, 16 Jan 2026 14:46:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768574814; bh=AjApcZ4VYkMiShoCKJtmD6SizN9yB/T+ppsUzY4US+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r3zQUd+WdXL/Ekgh7WCVp353/D0cljbmAF3i/1H6KEyGZ6wDOVJ0uq0QHeUfGJJZr usKJdWmXaIrEmnAenvcrj1LE/iUNFjo5NpaSGBR+yzYP5mT8UwZ7fNtG3zTKzDPqtq qSMlE7w4GH0A4efeJA8o0/LCk3h7bCuJgnw+EMjKxvQh/3bgxRYpjXNdf+dENZzYdx OZ071RzKnks1dp0lOAsi90FOL6VyqwmUiupusTY9P9lqQhIYopK3CDrZPvhS0zFMdc il6TLgOfdl1gmSCr9nzHVdyaiqOJo56+HJNJlQYy4vzpfrBhW1vqWc9f1j5MpOOi2v f+32VovwNXrGQ== From: Chuck Lever To: Al Viro , Christian Brauner , Jan Kara Cc: , linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-cifs@vger.kernel.org, , linux-f2fs-devel@lists.sourceforge.net, hirofumi@mail.parknet.co.jp, linkinjeon@kernel.org, sj1557.seo@samsung.com, yuezhang.mo@sony.com, almaz.alexandrovich@paragon-software.com, slava@dubeyko.com, glaubitz@physik.fu-berlin.de, frank.li@vivo.com, tytso@mit.edu, adilger.kernel@dilger.ca, cem@kernel.org, sfrench@samba.org, pc@manguebit.org, ronniesahlberg@gmail.com, sprasad@microsoft.com, trondmy@kernel.org, anna@kernel.org, jaegeuk@kernel.org, chao@kernel.org, hansg@kernel.org, senozhatsky@chromium.org, Chuck Lever Subject: [PATCH v5 14/16] nfsd: Report export case-folding via NFSv3 PATHCONF Date: Fri, 16 Jan 2026 09:46:13 -0500 Message-ID: <20260116144616.2098618-15-cel@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260116144616.2098618-1-cel@kernel.org> References: <20260116144616.2098618-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Chuck Lever The hard-coded MSDOS_SUPER_MAGIC check in nfsd3_proc_pathconf() only recognizes FAT filesystems as case-insensitive. Modern filesystems like F2FS, exFAT, and CIFS support case-insensitive directories, but NFSv3 clients cannot discover this capability. Query the export's actual case behavior through ->fileattr_get instead. This allows NFSv3 clients to correctly handle case sensitivity for any filesystem that implements the fileattr interface. Filesystems without ->fileattr_get continue to report the default POSIX behavior (case-sensitive, case-preserving). This change assumes the ("fat: Implement fileattr_get for case sensitivity") has been applied, which ensures FAT filesystems report their case behavior correctly via the fileattr interface. Signed-off-by: Chuck Lever --- fs/nfsd/nfs3proc.c | 18 ++++++++++-------- fs/nfsd/vfs.c | 25 +++++++++++++++++++++++++ fs/nfsd/vfs.h | 2 ++ 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c index 42adc5461db0..9be0aca01de0 100644 --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c @@ -717,17 +717,19 @@ nfsd3_proc_pathconf(struct svc_rqst *rqstp) if (resp->status == nfs_ok) { struct super_block *sb = argp->fh.fh_dentry->d_sb; + bool case_insensitive, case_preserving; - /* Note that we don't care for remote fs's here */ - switch (sb->s_magic) { - case EXT2_SUPER_MAGIC: + if (sb->s_magic == EXT2_SUPER_MAGIC) { resp->p_link_max = EXT2_LINK_MAX; resp->p_name_max = EXT2_NAME_LEN; - break; - case MSDOS_SUPER_MAGIC: - resp->p_case_insensitive = 1; - resp->p_case_preserving = 0; - break; + } + + resp->status = nfsd_get_case_info(&argp->fh, + &case_insensitive, + &case_preserving); + if (resp->status == nfs_ok) { + resp->p_case_insensitive = case_insensitive; + resp->p_case_preserving = case_preserving; } } diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 168d3ccc8155..f077032b42c3 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "xdr3.h" @@ -2871,3 +2872,27 @@ nfsd_permission(struct svc_cred *cred, struct svc_export *exp, return err? nfserrno(err) : 0; } + +/** + * nfsd_get_case_info - get case sensitivity info for a file handle + * @fhp: file handle that has already been verified + * @case_insensitive: output, true if the filesystem is case-insensitive + * @case_preserving: output, true if the filesystem preserves case + * + * Returns nfs_ok on success, or an nfserr on failure. + */ +__be32 +nfsd_get_case_info(struct svc_fh *fhp, bool *case_insensitive, + bool *case_preserving) +{ + struct file_kattr fa = {}; + int err; + + err = vfs_fileattr_get(fhp->fh_dentry, &fa); + if (err && err != -ENOIOCTLCMD) + return nfserrno(err); + + *case_insensitive = fa.case_insensitive; + *case_preserving = !fa.case_nonpreserving; + return nfs_ok; +} diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h index e192dca4a679..1ff62eecec09 100644 --- a/fs/nfsd/vfs.h +++ b/fs/nfsd/vfs.h @@ -155,6 +155,8 @@ __be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, loff_t *, struct readdir_cd *, nfsd_filldir_t); __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, struct kstatfs *, int access); +__be32 nfsd_get_case_info(struct svc_fh *fhp, bool *case_insensitive, + bool *case_preserving); __be32 nfsd_permission(struct svc_cred *cred, struct svc_export *exp, struct dentry *dentry, int acc); -- 2.52.0