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 08F912DCC04; Wed, 14 Jan 2026 14:29:39 +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=1768400979; cv=none; b=o+wGDU5vQUnX0cqir/FALNhMJopP1cnrJA414Js7d2td4PpvQFj9r95quSQ0M2m3KZBD2i+QX23+USGMPMPN9ReraonBm9ddx/2x5Dw+vVWFqfnfRDgy17dZjQgPYJG9zuBmVM5xOBGSW+NOZ6D1dlG7KZd6ea24xcWBpdVrDow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768400979; c=relaxed/simple; bh=AjApcZ4VYkMiShoCKJtmD6SizN9yB/T+ppsUzY4US+Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=izN04CKMSAV2sXnqjYn/JrTlQQO4V8YZnmIEm6+xm9xUlDiJK0hdNlcBtgJrj222L3V1orbxPOl2qfWO4VEKlD7hokMX2zU3KIMr8ftFL2ILtk9mcHhvWtEtpaTDZl37f/wLxkwosU8NbsSx3+w871WqmCmOb8A36pxyZUUaW5o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KZrZSuAh; 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="KZrZSuAh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADA37C16AAE; Wed, 14 Jan 2026 14:29:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768400978; bh=AjApcZ4VYkMiShoCKJtmD6SizN9yB/T+ppsUzY4US+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZrZSuAh1IIuShN/NGZJVSpDnmo6brLNX+8ixB3A3LxhUya23u4pFa5+8YDUHPEtq jcXaB0DDTR4EkxWWYm4BbKvZMhTI0kYBqM1zsef91BBPRv3BpHDlwR/0i7QrrKPaky b/QQf5xyU0sgJPlwgF9qte+Bkh6kF8lyoSE4T+jgz6W808/3ZCCzYOvxgYM2fixg6Z DwFaOAOiYod17JRrTRRItaTN8QqYapyPj41TQkmegZIIyIEbtTJRUm3ELVvCNNAZgl KLKmZ26b5EyHsQC3xlJ7RskS1xGy3IfuCHFKEV9ohDoNrt+7W0hPMAzq53yb4nv10T LkpbcauZJ46Bg== 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 v4 14/16] nfsd: Report export case-folding via NFSv3 PATHCONF Date: Wed, 14 Jan 2026 09:28:57 -0500 Message-ID: <20260114142900.3945054-15-cel@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260114142900.3945054-1-cel@kernel.org> References: <20260114142900.3945054-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..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 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 4415ED37E39 for ; Wed, 14 Jan 2026 14:29:56 +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=v4rsBARQBx/zklcdc2p4AEeExtS8jeykr72DUN137+c=; b=j/TZeVAQzIpLvFM05cCM3LWklU 42t8OVEh/Uu+9sMj0VUOvOYbDBO8PnOQrBZGtXkbxlmJF/9e/9lkCIXRRGr0AB07pVKBuBxomO+U6 luS/XZ37sCyoLZgcQM4H3u2RpYB2V5EQ3+xwgKkJIRB1ORf5kWTe1t6cd5XW2rwLAuO0=; 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 1vg1sh-0003Ju-5a; Wed, 14 Jan 2026 14:29:55 +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 1vg1sb-0003Iy-QP for linux-f2fs-devel@lists.sourceforge.net; Wed, 14 Jan 2026 14:29:50 +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=6pVIDvQ98PbOlcvUn0/AnU//c3Ve1lLfc3XxO3376PE=; b=fy3Y7a5KrXZTsT/HPjS73HBg6p OT2CPADvGOT3AwVRKlR0fleFvckxaHePpxGoTO+XmwCbuR2qZaLgFpU8XScNgJthUET1/SH8wgP6T 6ahmt3t33+fEtUZY+IWDpxBlvZn15Y4dg5UJ30tds9HZN/GeCqWqUVd0/3xVCt9sAG3Q=; 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=6pVIDvQ98PbOlcvUn0/AnU//c3Ve1lLfc3XxO3376PE=; b=GoztFHBzhTQcUg0F2WeCJGtOti mTtsYsG7U5A69Xb90RbJctXLEnAvorZVdhyb826PU+cVWqOXEODDa8vT5scouWdbC0ZGMuo8jvRdQ gEARdI1vM7+yH8H8jx/XzgvOzO5WBDCk2xXgj+/75AexUHsjdWiqx1H1mGutiNYfFHRM=; Received: from tor.source.kernel.org ([172.105.4.254]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1vg1sb-0001Hm-NG for linux-f2fs-devel@lists.sourceforge.net; Wed, 14 Jan 2026 14:29:50 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 2C2F060051; Wed, 14 Jan 2026 14:29:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADA37C16AAE; Wed, 14 Jan 2026 14:29:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768400978; bh=AjApcZ4VYkMiShoCKJtmD6SizN9yB/T+ppsUzY4US+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZrZSuAh1IIuShN/NGZJVSpDnmo6brLNX+8ixB3A3LxhUya23u4pFa5+8YDUHPEtq jcXaB0DDTR4EkxWWYm4BbKvZMhTI0kYBqM1zsef91BBPRv3BpHDlwR/0i7QrrKPaky b/QQf5xyU0sgJPlwgF9qte+Bkh6kF8lyoSE4T+jgz6W808/3ZCCzYOvxgYM2fixg6Z DwFaOAOiYod17JRrTRRItaTN8QqYapyPj41TQkmegZIIyIEbtTJRUm3ELVvCNNAZgl KLKmZ26b5EyHsQC3xlJ7RskS1xGy3IfuCHFKEV9ohDoNrt+7W0hPMAzq53yb4nv10T LkpbcauZJ46Bg== To: vira, Christian Brauner , Jan Kara Date: Wed, 14 Jan 2026 09:28:57 -0500 Message-ID: <20260114142900.3945054-15-cel@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260114142900.3945054-1-cel@kernel.org> References: <20260114142900.3945054-1-cel@kernel.org> MIME-Version: 1.0 X-Headers-End: 1vg1sb-0001Hm-NG Subject: [f2fs-dev] [PATCH v4 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..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 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel