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 A2BF340DFA5; Sat, 25 Apr 2026 01:53:36 +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=1777082016; cv=none; b=PCOtrQ7yQ6r3WYsCljf6za7tkUIU8rB2vbRzxoTVruq/uubhiw0BGsQ/y24oDTHBHw11yAaX0h1xFCTaDGAled+N+VHXMaVRAEe6P6LsQH/zV3lv9JN81m2gMpyCBIzQlyVZ5kibRYZGJGjeRlFrLARQz9jXqx4P5+W+5U8labg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777082016; c=relaxed/simple; bh=0ZgfzLmgsh6e0l/cgy9Aq0IcvErUYWyzdo9BjjxntFE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NyUzN+HwzL25DS+oP/5PJLYuDNEdDX3CcZZDvmx3OMoaP83oNM8TNUKcAmtXFSAPRvzu24YtGnElATbDvZNNYsi9A3aN+omTZp7jLyHHTZYvXzh/gs1DxUDRAftJM1cjGDaShR1qcqrsnoMs1YW28aqKC6g7PEbXoJj7WTX2HYM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UBs5CqZk; 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="UBs5CqZk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 002FEC2BCB2; Sat, 25 Apr 2026 01:53:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777082016; bh=0ZgfzLmgsh6e0l/cgy9Aq0IcvErUYWyzdo9BjjxntFE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=UBs5CqZk9XmHH+jgnzvUHWwrjxpWzmgBWd233DJnIteiFNVgF5sdQ3cWc/IMLCZGN sgbPO7lQQftktNrs5nH2ccx7tJ1wW42rD0ntCCTww854954wi9QhyVq8wnLagXZXlT wvS/Pe9Mcx4l3TlTPCA1MlcXBMRC3LClIV1zkb4ehj9hDXqppBL9GcU7BjijAwUc3b 4CZTkDlLetCbFjNTj2wBJF903piUjaVjPwQcPMtvLms4Zg2PC/c3QaAoEzEj4QsJn6 D+NH1wQNf9G7eCbuvBOh6oqw4mdRqSYdRbJLGWmUcqNs8bNYIeuWlUCCgi5rC8yPtM qpm12Q/e3Wwjw== From: Chuck Lever Date: Fri, 24 Apr 2026 21:53:07 -0400 Subject: [PATCH v11 05/15] ntfs3: Implement fileattr_get for case sensitivity Precedence: bulk X-Mailing-List: linux-api@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260424-case-sensitivity-v11-5-de5619beddaf@oracle.com> References: <20260424-case-sensitivity-v11-0-de5619beddaf@oracle.com> In-Reply-To: <20260424-case-sensitivity-v11-0-de5619beddaf@oracle.com> To: Al Viro , Christian Brauner , Jan Kara Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-api@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 , Roland Mainz X-Mailer: b4 0.16-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3307; i=chuck.lever@oracle.com; h=from:subject:message-id; bh=the5hfrb+NDfAlxqcoZBavzUZ+JgwGcn+44RCBEP0nA=; b=owEBbQKS/ZANAwAKATNqszNvZn+XAcsmYgBp7B6QyVflZ8+aiiVlNbBUCfNUyu6AJiwcinI9A Y3kemH1MfeJAjMEAAEKAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCaewekAAKCRAzarMzb2Z/ l/DLD/9HvrJZgrlELaA9rMcCLaKNI+B6L6bhlkPmhjbLhUEmS+AQ4OcaPliMGmAB0AOiqZDAYhX hp1us4Ye+CBbz/O640iIQoUTlVgWwh4Gc0r2xox7g6OAkZ8Y3KliS+8q3RGDJ8xrMGM5Cth3XYK Yc4qRzxPlFlVD835duE0tCqQrccEpPkeTkJLcjixk1oZFYH07yzm3g+hRoS660B7DMjHx8UUGbT xfJujr4TKVOC9sIwcdVgHjMkdOL+OIupMCZAAV7YKe1x5QdtJir8BOXDbQV0sOA/nsbmGaRuPri UusmK9pPm4fIDh2hLZJVxU5G4gcYZhKq4on8CvuALeuNybu2no0SBiXn6yb1bPaNxjfFOzE+qnc cTXb/k5ZZd7In5lJnY3Eqd6gFH1Q7lMwESttYNfFk2zR6Y7IOVrWwdVVY0S8V3GIbkWUyxQVsB5 v8nO2aFd41BIQKodyOTAy/K1kZgNYcYoh/isImgVihrSSp8bacOILRzIis9lp7sbad3ndgHcf3M oCd6Dyfua1voL+lGbdMUF2ojOn+UNiovHxHXWqnA16VappNdb37VlzGyWkWnitjOc3jkdodM7Ki Bj7TzOSWvkX3yYrHp3xIcabfI7Q5lra00YwRJs6ajG1YvHvH12viJamZWFlCDN8FTQREsinpNND +BFfUs9c7NLNrrA== X-Developer-Key: i=chuck.lever@oracle.com; a=openpgp; fpr=28B2E5B01286DF243CF23EFE336AB3336F667F97 From: Chuck Lever Report NTFS case sensitivity behavior via the FS_XFLAG_CASEFOLD flag. NTFS always preserves case at rest. Reviewed-by: Roland Mainz Signed-off-by: Chuck Lever --- fs/ntfs3/file.c | 25 +++++++++++++++++++++++++ fs/ntfs3/inode.c | 1 + fs/ntfs3/namei.c | 2 ++ fs/ntfs3/ntfs_fs.h | 1 + 4 files changed, 29 insertions(+) diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index b041639ab406..447ea0f9b9d5 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -180,6 +180,30 @@ long ntfs_compat_ioctl(struct file *filp, u32 cmd, unsigned long arg) } #endif +/* + * ntfs_fileattr_get - inode_operations::fileattr_get + */ +int ntfs_fileattr_get(struct dentry *dentry, struct file_kattr *fa) +{ + struct inode *inode = d_inode(dentry); + struct ntfs_sb_info *sbi = inode->i_sb->s_fs_info; + + /* Avoid any operation if inode is bad. */ + if (unlikely(is_bad_ni(ntfs_i(inode)))) + return -EINVAL; + + /* + * NTFS preserves case (the default). Case sensitivity depends on + * mount options: with "nocase", NTFS is case-insensitive; + * otherwise it is case-sensitive. + */ + if (sbi->options->nocase) { + fa->fsx_xflags |= FS_XFLAG_CASEFOLD; + fa->flags |= FS_CASEFOLD_FL; + } + return 0; +} + /* * ntfs_getattr - inode_operations::getattr */ @@ -1547,6 +1571,7 @@ const struct inode_operations ntfs_file_inode_operations = { .get_acl = ntfs_get_acl, .set_acl = ntfs_set_acl, .fiemap = ntfs_fiemap, + .fileattr_get = ntfs_fileattr_get, }; const struct file_operations ntfs_file_operations = { diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 42af1abe17f8..a5ff04c2efd3 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -2095,6 +2095,7 @@ const struct inode_operations ntfs_link_inode_operations = { .get_link = ntfs_get_link, .setattr = ntfs_setattr, .listxattr = ntfs_listxattr, + .fileattr_get = ntfs_fileattr_get, }; const struct address_space_operations ntfs_aops = { diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c index b2af8f695e60..eb241d7796ba 100644 --- a/fs/ntfs3/namei.c +++ b/fs/ntfs3/namei.c @@ -518,6 +518,7 @@ const struct inode_operations ntfs_dir_inode_operations = { .getattr = ntfs_getattr, .listxattr = ntfs_listxattr, .fiemap = ntfs_fiemap, + .fileattr_get = ntfs_fileattr_get, }; const struct inode_operations ntfs_special_inode_operations = { @@ -526,6 +527,7 @@ const struct inode_operations ntfs_special_inode_operations = { .listxattr = ntfs_listxattr, .get_acl = ntfs_get_acl, .set_acl = ntfs_set_acl, + .fileattr_get = ntfs_fileattr_get, }; const struct dentry_operations ntfs_dentry_ops = { diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index bbf3b6a1dcbe..41db22d652c4 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -529,6 +529,7 @@ bool dir_is_empty(struct inode *dir); extern const struct file_operations ntfs_dir_operations; /* Globals from file.c */ +int ntfs_fileattr_get(struct dentry *dentry, struct file_kattr *fa); int ntfs_getattr(struct mnt_idmap *idmap, const struct path *path, struct kstat *stat, u32 request_mask, u32 flags); int ntfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry, -- 2.53.0