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 6DC202F5308; Tue, 17 Feb 2026 21:48:11 +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=1771364891; cv=none; b=oYHsoyWM7iim23i6I75ASvKb5kK8dGKeBxym95uxPlxnKizjcvhc41L3txzVkUhmfpItEbXB72EiJH8vyLSKcxtBuNUmdCdTj17qc1yb/jdmblRD4rSdyyifzo7lopuGyaCabW/wZG4faD3Y0YjAUDR4o4NZZHJYfRMGLo6/AvE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771364891; c=relaxed/simple; bh=5J2/6flRB909Ns0eqSfrHWl5jUmbSKDChds8uNX1o+Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uUBvv1/xqsU703JZ9KIVcg17SwL05HzU+97gcTSrkpPkZe9JGcobuyi8DdkC+Eql7ZNY7JQBkfBfZe/OYDnOkuWFu/KCv+drihi4x9HyA2vGkQ2zsrFHlpOJdeCl1rnsqSumBNE4NjLhIXj+VXVcHxaMqN/TwndRe+k8/70FZdw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u6t+2zKw; 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="u6t+2zKw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 119F0C4CEF7; Tue, 17 Feb 2026 21:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771364891; bh=5J2/6flRB909Ns0eqSfrHWl5jUmbSKDChds8uNX1o+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u6t+2zKw/OruF4yK6QrMVZv/p9opIcZqoTW4zBnJEZ/v54wYSALunMMB3TrlDvduJ Qxcd+ZBu0V/alHR3HQCd4VBDT8cXkC+uSdh+Lk0Wg8hcIipmwRYjdZ26XIoze9mfhH RGUetd0fZE30GAHmVg9GWx5iQQGetUv0aTS9A4P4yS2Kr5bRbRqkO0yfXpngNyrRqO X9VM2MhU4qxJzgRWXbSqFHmPWylByjwsTg4egbKHAuxCemu93scSVR2C+sjpVBBa9c L48xM0deidoXI7mI8CNJgBUerIxnQ8+AnKS2FhN+HhCel32Txo9XxiZZeUp10jtloj QOgLsfj64LcqQ== From: Chuck Lever 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 Subject: [PATCH v8 10/17] cifs: Implement fileattr_get for case sensitivity Date: Tue, 17 Feb 2026 16:47:34 -0500 Message-ID: <20260217214741.1928576-11-cel@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260217214741.1928576-1-cel@kernel.org> References: <20260217214741.1928576-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 Upper layers such as NFSD need a way to query whether a filesystem handles filenames in a case-sensitive manner. Report CIFS/SMB case handling behavior via the FS_XFLAG_CASEFOLD flag. CIFS servers (typically Windows or Samba) are usually case-insensitive but case-preserving, meaning they ignore case during lookups but store filenames exactly as provided. The implementation reports case sensitivity based on the nocase mount option, which reflects whether the client expects the server to perform case-insensitive comparisons. When nocase is set, the mount is reported as case-insensitive. The callback is registered in all three inode_operations structures (directory, file, and symlink) to ensure consistent reporting across all inode types. Signed-off-by: Chuck Lever --- fs/smb/client/cifsfs.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c index afda1d7c1ee1..9d85785a1c67 100644 --- a/fs/smb/client/cifsfs.c +++ b/fs/smb/client/cifsfs.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include "cifsfs.h" @@ -1189,6 +1190,22 @@ struct file_system_type smb3_fs_type = { MODULE_ALIAS_FS("smb3"); MODULE_ALIAS("smb3"); +static int cifs_fileattr_get(struct dentry *dentry, struct file_kattr *fa) +{ + struct cifs_sb_info *cifs_sb = CIFS_SB(dentry->d_sb); + struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); + + /* + * Case sensitivity is reported based on the nocase mount option. + * CIFS servers typically perform case-insensitive lookups while + * preserving case in stored filenames. The nocase option indicates + * case-insensitive comparison is in effect for this mount. + */ + if (tcon->nocase) + fa->fsx_xflags |= FS_XFLAG_CASEFOLD; + return 0; +} + const struct inode_operations cifs_dir_inode_ops = { .create = cifs_create, .atomic_open = cifs_atomic_open, @@ -1206,6 +1223,7 @@ const struct inode_operations cifs_dir_inode_ops = { .listxattr = cifs_listxattr, .get_acl = cifs_get_acl, .set_acl = cifs_set_acl, + .fileattr_get = cifs_fileattr_get, }; const struct inode_operations cifs_file_inode_ops = { @@ -1216,6 +1234,7 @@ const struct inode_operations cifs_file_inode_ops = { .fiemap = cifs_fiemap, .get_acl = cifs_get_acl, .set_acl = cifs_set_acl, + .fileattr_get = cifs_fileattr_get, }; const char *cifs_get_link(struct dentry *dentry, struct inode *inode, @@ -1250,6 +1269,7 @@ const struct inode_operations cifs_symlink_inode_ops = { .setattr = cifs_setattr, .permission = cifs_permission, .listxattr = cifs_listxattr, + .fileattr_get = cifs_fileattr_get, }; /* -- 2.53.0