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 74AB432C924; Wed, 22 Apr 2026 23:30:29 +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=1776900629; cv=none; b=uMRzyHai4pnUPv8qNkqg8N4wFD89JcR0Dw/swIqGJrITsB5AeYgIt2gyoe6fhoPNtbRgxJtHnSY0478wCrLtNeKaFeyfKXRHRbi53bNrhUkHHayrt3xiDoDPYPzqC++pJueWsUgwS1jsKAxpAWPr0dPF/aAEC2Yrw2JVbJMGgA4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776900629; c=relaxed/simple; bh=uXDyD+EwjECxSZf0mUntOuY7XcXST0vj1dof/taqFWQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B9POSmxeoN3fQpa2wusjlNyVUgNUyXPLnwmf2sSWFWeevT9lWQtX+b/JoseRXKa/UCDPdU85WCw++yIG3F5dbR6aRkWEBiqiwrbah29ocTSSx47TEpUnhJOCzlBoOg9jdedN09Z88GDTt33LgF1SQ+YAX/JFxvms6x22O/wGRYc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TfZ2ZURi; 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="TfZ2ZURi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2FD5C2BCB6; Wed, 22 Apr 2026 23:30:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776900629; bh=uXDyD+EwjECxSZf0mUntOuY7XcXST0vj1dof/taqFWQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=TfZ2ZURiQDjM9jIhw2PX5LXyihmkQrEF5J1XlyfHeDUZ6P/64RtmHifZk6bN89ST6 9rJFkc0sUEYRcrGQWxq7e6SJO7B028PBh+ZqFnGJTIvH5m4dGUO/P9vlXGMjVd/MXC TeUfdFTvsUJ3vHXf8HeBREc+90qA8nU2vqk18YGB0af1koVDg2AAqhcdXwgoNlbjxK f4Dqk6NDvzo2IcZkNdjbF2aD2nfJ+hrJLgKEPehm0dFPCVTbh9cmr3iH24f727gE/t uQExxl40mTqZRppiahA+Mjla5y9vutYxg9F+g6GExP0pBKwwylA3oJpuS7dricvbWs Bssrjg1Gu5tUw== From: Chuck Lever Date: Wed, 22 Apr 2026 19:29:59 -0400 Subject: [PATCH v9 05/17] ntfs3: Implement fileattr_get for case sensitivity Precedence: bulk X-Mailing-List: linux-fsdevel@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: <20260422-case-sensitivity-v9-5-be023cc070e2@oracle.com> References: <20260422-case-sensitivity-v9-0-be023cc070e2@oracle.com> In-Reply-To: <20260422-case-sensitivity-v9-0-be023cc070e2@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 X-Mailer: b4 0.16-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3211; i=chuck.lever@oracle.com; h=from:subject:message-id; bh=TP8XZKgmTAxM/QUA73jikSOpFVJB/k8sBiRSJXDKGtA=; b=owEBbQKS/ZANAwAKATNqszNvZn+XAcsmYgBp6VoF54td2uxTYw9UHbUy9URChJW7i55Pb0Wpv R3sQhyegaKJAjMEAAEKAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCaelaBQAKCRAzarMzb2Z/ l5/7D/9F9AL04x9XuT2y2wyuPieesYRkavfa/vcDiOeC1gwg9Sh3F7OabChty8t5hsgf8xpL/zN KzI5qD27wQgBA4c/zOcyb4d0/AIBeILDnAFeWY8IrPfdsq/tVcuDB3HRxb6sc2TOf+xlLjY3zgm 9bJ4DtlcJW9UlvzPz9qA9n8cYSzfAbkiBBeQJ3QEB5rRnIjbwrKywPWmmb1jlNcHmnn2Lv71qFu rkYL/qPQ37z38s+HpCzvrqksJEVSdSawJRZk4SuMoLSADwQjL97whNOyrRdCJSUhpWOz/o744Bv bLsQcg5D53nUl5E5QUCL0y/dyyg8GqIynrq9XWTzvZhojKj/ahkONOL4YAdGg3aOrlYBt3aIw0X FcEQnZm8zwFlUaRXtgi5p9MwXvzn25D0y2y+ltllnJ4rnh6d9VGIBvgYzbRbRpy41BenSp/99N7 gXFgYbuhhkbeL4cioFNW2+Ia0tPMFcJMsx1F2SBslUTm1YBkoo8QydjNaHsKGhEdENKptSMmrqS 82vqKa4OEgl1dL9CovJEgEv/qgkgRcCDrHxIIAvAiFpl8mJUp/PKQwWNWjXxnR1yrGnWLPleNOH hhdgWrfSU1al7RS5D3rfdzMK/5DxQ95JySEkUHuZIcHmVpA6Id7hGcEHABUsnXInJ4Wkt3x2pDc uTN9G/qgLV/vpzA== 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. Signed-off-by: Chuck Lever --- fs/ntfs3/file.c | 23 +++++++++++++++++++++++ fs/ntfs3/inode.c | 1 + fs/ntfs3/namei.c | 2 ++ fs/ntfs3/ntfs_fs.h | 1 + 4 files changed, 27 insertions(+) diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index b041639ab406..bb3b3a89204d 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -180,6 +180,28 @@ 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; + return 0; +} + /* * ntfs_getattr - inode_operations::getattr */ @@ -1547,6 +1569,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