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 6DF5C387357; Mon, 12 Jan 2026 17:47:12 +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=1768240032; cv=none; b=dDikngoDigV7plArtEp3aCDPL/z8K6cYMsOtMhulEiqQ5CtU8h5tc+VSge+GNUzGbGpBo0ueYb5nVfLEJ0LkeUNs/Cgo77HhgFXACAqWsFyZXk73vT2ZxQ5HeFg9hP6F4UBL2zl3czCgeyE0yZa3vpG5lgJWAnfdSIWHctDL6/M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768240032; c=relaxed/simple; bh=FNnQXzetRZnnZFm3vQojxRo6HKFl/rXATvv1pgqIqqE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RccXzBVsgFeYYULqi3JPwQXW2R7qfqXTxpXt7NVOeiVVYeRqn2sMNksEHsps3Sti/Xojch2F4houxkgOvI+LB6KQLFXFCXE0az3o4kjT0RkJYxqaAm/P2/AAZpZ9Yj0FXsbbFVVrXPz5JehhCDf7NR9RxWKKHzZLmMCBTQd1Prw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RnQGgjJk; 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="RnQGgjJk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 104C9C19422; Mon, 12 Jan 2026 17:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768240032; bh=FNnQXzetRZnnZFm3vQojxRo6HKFl/rXATvv1pgqIqqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RnQGgjJkl5MvLK8IWuIGQCtpCsj222UQq6+VqBK4bI/8qvaQqs8tQ4G2KsoO0F2Bd OZBW+xixN/AY98ceYoSXNSf4XFef62P2IwefupDrZHLwN8xbAWslliBCnVzrgdq+Zv 9ygdnpvBzR9if0DYKB29sOpbxWpyFjLHQE6q+x+qQBro44cT6bV+BzfRsmifRc6ZLK NU0goWzveQ4drdH2QZ7OLrnyrCMN1pvRHWNqKQIEhDHAiFwUaYkHogyHoMMuLdXuDs qdO0MBhJxi8nIcTTAiBFAm0zd3MR6k4NcsciMzGs9YZG8Y9VJqzbZuFlf2YlvuJ+fH hRRIzK4F6NGOw== From: Chuck Lever To: vira, 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 v3 14/16] nfsd: Report export case-folding via NFSv3 PATHCONF Date: Mon, 12 Jan 2026 12:46:27 -0500 Message-ID: <20260112174629.3729358-15-cel@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260112174629.3729358-1-cel@kernel.org> References: <20260112174629.3729358-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-cifs@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..f65985813fbf 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_preserving; + 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D0F96CF45B2 for ; Mon, 12 Jan 2026 17:47:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:MIME-Version:References:In-Reply-To: Message-ID:Date:To:Sender:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=O425ZlXzVNPgByZu0w5DVUwUlxAZKlNVECkGJ+StDQg=; b=UT8MbG3olYY0T1ovN7ovWyfiN0 g0Z07fr4KisjCg/e4wmCUMXlFPVaFiTQNxPfRFWA4ZxzFuT0NvoIz8gkVGxrUjt2b0G5/j1s+OOAu g/izldg75+vY1Wr8MTOzsZcSgXYCSkp2gdmozNvsfnsn6Y+SP3WPkJGJ/IY7km3pmpeY=; Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vfM0h-00086k-M1; Mon, 12 Jan 2026 17:47:24 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vfM0g-00086X-FF for linux-f2fs-devel@lists.sourceforge.net; Mon, 12 Jan 2026 17:47:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=R1FLU/wPepqo08AOT1+X0FbG8NWlg8/DLDC3a+iHRw8=; b=UlZt8ytr00IzPrKbRDfIWxP3lu 4v/OHaXJrT+i6OsIIIkFZPeHhiJPxP+olpEroNablbu+Id/JN9KBTwHYq8mXxefxOe3HJ6bDd8oGf sdHVIDSbKyEU2qqxsOUHZ52Wtkvt7rIbK+zLUtH4miSdaw34mb+3DKeYo6jTqg4CWgUs=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=R1FLU/wPepqo08AOT1+X0FbG8NWlg8/DLDC3a+iHRw8=; b=IZjiMCPVWRHRwSkVTZ0oAahbPN T3Tj+5ujHz5jbuYnlGpvMlvt7mfVE0Qn0B8Ozaemvz4WH5qxye+N3Jmw7/JrZ5tG/Goy3s7ooa0fN VgCYTrgjI2J6qXFSLVhIgPhZz9QIs4uD214wqFQX/UuxvvCDttWJLwqVkbl6OSpra1DY=; Received: from sea.source.kernel.org ([172.234.252.31]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1vfM0g-0008Ub-OK for linux-f2fs-devel@lists.sourceforge.net; Mon, 12 Jan 2026 17:47:23 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 7446744343; Mon, 12 Jan 2026 17:47:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 104C9C19422; Mon, 12 Jan 2026 17:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768240032; bh=FNnQXzetRZnnZFm3vQojxRo6HKFl/rXATvv1pgqIqqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RnQGgjJkl5MvLK8IWuIGQCtpCsj222UQq6+VqBK4bI/8qvaQqs8tQ4G2KsoO0F2Bd OZBW+xixN/AY98ceYoSXNSf4XFef62P2IwefupDrZHLwN8xbAWslliBCnVzrgdq+Zv 9ygdnpvBzR9if0DYKB29sOpbxWpyFjLHQE6q+x+qQBro44cT6bV+BzfRsmifRc6ZLK NU0goWzveQ4drdH2QZ7OLrnyrCMN1pvRHWNqKQIEhDHAiFwUaYkHogyHoMMuLdXuDs qdO0MBhJxi8nIcTTAiBFAm0zd3MR6k4NcsciMzGs9YZG8Y9VJqzbZuFlf2YlvuJ+fH hRRIzK4F6NGOw== To: vira, Christian Brauner , Jan Kara Date: Mon, 12 Jan 2026 12:46:27 -0500 Message-ID: <20260112174629.3729358-15-cel@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260112174629.3729358-1-cel@kernel.org> References: <20260112174629.3729358-1-cel@kernel.org> MIME-Version: 1.0 X-Headers-End: 1vfM0g-0008Ub-OK Subject: [f2fs-dev] [PATCH v3 14/16] nfsd: Report export case-folding via NFSv3 PATHCONF X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Chuck Lever via Linux-f2fs-devel Reply-To: Chuck Lever Cc: pc@manguebit.org, yuezhang.mo@sony.com, cem@kernel.org, almaz.alexandrovich@paragon-software.com, adilger.kernel@dilger.ca, linux-cifs@vger.kernel.org, sfrench@samba.org, slava@dubeyko.com, linux-ext4@vger.kernel.org, linkinjeon@kernel.org, sprasad@microsoft.com, frank.li@vivo.com, ronniesahlberg@gmail.com, glaubitz@physik.fu-berlin.de, jaegeuk@kernel.org, hirofumi@mail.parknet.co.jp, linux-nfs@vger.kernel.org, tytso@mit.edu, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, senozhatsky@chromium.org, Chuck Lever , hansg@kernel.org, anna@kernel.org, linux-fsdevel@vger.kernel.org, sj1557.seo@samsung.com, trondmy@kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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..f65985813fbf 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_preserving; + 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 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel