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 7999A1E0E08; Fri, 16 Jan 2026 14:46:59 +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=1768574819; cv=none; b=Z7l6i29zmo3Docmgz9Hjh/z2E42cmDhx/6UuRK0AVCAtb0FdGeO3SwPaokiXqR8yc1p4+5WcYidJdp2pdET3v/RIMpz3fzT8BkIDG2WutUAgh7w8OESNgh9dhv7ueMVeS5imwFMjgh2jW60gu9HHy1hSKZEUYqJ+j+UjDAtCT08= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768574819; c=relaxed/simple; bh=WULodj3ndaifHU9DlNb0w1E7YxSNfz8+hYky6+hNjMA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z1UCS622EFisPU7p3JLYz/WeVjmqLlZB+U+o13Vanc3FQdZhoQ2cul23kzyky0+gEoxVeoE1YTDG765mhAW3JWOJlqCL3eOyxtx5xl+8wRJnxyG5eJfgHwQkAsQFZUFc3DloRaqnkVk3wrrQB+4514aVtV0IB+gx+N46Q5yWQ+U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mtsgnLat; 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="mtsgnLat" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35DEBC16AAE; Fri, 16 Jan 2026 14:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768574819; bh=WULodj3ndaifHU9DlNb0w1E7YxSNfz8+hYky6+hNjMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mtsgnLatpOhe9kqnWRHmZwh5A/3hgyDsPKkyHY1PRTvRlU0+eOT7hKDZl0wG7WStN 3m33Rr/NxbHIy9fFYQBIqBlW6GdFXOP7tkP+DzN6zMLC2ntO8zB0C6vCIKJMpdTq+e VmkVEXX7M6qhXS7lcMKs+jvKtJQcqIkqpPfTOEZJhyrxximK0XcjOHxHcJGcOYtOTj aUDhA4bvmAp+TA4pLoqSw1vheM1ZHepi29vIdezq8hIBnYs8eP6kE/GnP8hFVe87Z1 1vY/Xi/Yl0fWVfDxWZmdomVLtBfaV2nFDDR3ZT1niuIxMgBf0Ubjfs+t9Q6dBHqOwU Ya4whlE0UUDDA== From: Chuck Lever To: Al Viro , 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 v5 16/16] ksmbd: Report filesystem case sensitivity via FS_ATTRIBUTE_INFORMATION Date: Fri, 16 Jan 2026 09:46:15 -0500 Message-ID: <20260116144616.2098618-17-cel@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260116144616.2098618-1-cel@kernel.org> References: <20260116144616.2098618-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 ksmbd hard-codes FILE_CASE_SENSITIVE_SEARCH and FILE_CASE_PRESERVED_NAMES in FS_ATTRIBUTE_INFORMATION responses, incorrectly indicating all exports are case-sensitive. This breaks clients accessing case-insensitive filesystems like exFAT or ext4/f2fs directories with casefold enabled. Query actual case behavior via vfs_fileattr_get() and report accurate attributes to SMB clients. Filesystems without ->fileattr_get continue reporting default POSIX behavior (case-sensitive, case-preserving). SMB's FS_ATTRIBUTE_INFORMATION reports per-share attributes from the share root, not per-file. Shares mixing casefold and non-casefold directories report the root directory's behavior. Acked-by: Namjae Jeon Signed-off-by: Chuck Lever --- fs/smb/server/smb2pdu.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index 2fcd0d4d1fb0..f579093bb418 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "glob.h" #include "smbfsctl.h" @@ -5486,16 +5487,28 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work, case FS_ATTRIBUTE_INFORMATION: { FILE_SYSTEM_ATTRIBUTE_INFO *info; + struct file_kattr fa = {}; size_t sz; + u32 attrs; + int err; info = (FILE_SYSTEM_ATTRIBUTE_INFO *)rsp->Buffer; - info->Attributes = cpu_to_le32(FILE_SUPPORTS_OBJECT_IDS | - FILE_PERSISTENT_ACLS | - FILE_UNICODE_ON_DISK | - FILE_CASE_PRESERVED_NAMES | - FILE_CASE_SENSITIVE_SEARCH | - FILE_SUPPORTS_BLOCK_REFCOUNTING); + attrs = FILE_SUPPORTS_OBJECT_IDS | + FILE_PERSISTENT_ACLS | + FILE_UNICODE_ON_DISK | + FILE_SUPPORTS_BLOCK_REFCOUNTING; + err = vfs_fileattr_get(path.dentry, &fa); + if (err && err != -ENOIOCTLCMD) { + path_put(&path); + return err; + } + if (!fa.case_insensitive) + attrs |= FILE_CASE_SENSITIVE_SEARCH; + if (!fa.case_nonpreserving) + attrs |= FILE_CASE_PRESERVED_NAMES; + + info->Attributes = cpu_to_le32(attrs); info->Attributes |= cpu_to_le32(server_conf.share_fake_fscaps); if (test_share_config_flag(work->tcon->share_conf, -- 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 DE898C982CC for ; Fri, 16 Jan 2026 14:47:23 +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=9mRLz0U+gjhvrnybucBoAYq1dSzJz4wO3cJlVmN5nO4=; b=LFnsacUdcGCIUqcvVbbkOzwx6r wuZ5V2VgwWaJ0IOLGUbtumqqUgTH0yWTUiHSvppMaanTcxaEWVQWhkJ/vlAJm8ZeHqdIMbW+7EwTF a77DOacVw7Twdp3FBKBuFrXN02YONbgly8fNDbL5oq22JWxCeooeyGMI5eA/57CZnqHI=; 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 1vgl6g-0001zU-QA; Fri, 16 Jan 2026 14:47:23 +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 1vgl6T-0001x9-UA for linux-f2fs-devel@lists.sourceforge.net; Fri, 16 Jan 2026 14:47:10 +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=ApZQEDMH+pKncNXBOdm4bTdpW/JwLXyA2ITsKgSmFcA=; b=WAgWEXehuPkpRyI6qWvObYf+K5 pkKHQ0HLoxyBonyDEvyGUie9t8SpCBkJyNgpn1AQKlnIwufdqU97howI0w3zacl08Zj3SepLq3/sD 4n9syYkbL42GsSBo3hahWjxDabB6cwyzaSevm5KFcwm2JJHgZjbdI6uHl7jTNQuvUiHM=; 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=ApZQEDMH+pKncNXBOdm4bTdpW/JwLXyA2ITsKgSmFcA=; b=P4VkTnsmfNRSYDmcOffF2Qcc0G jBEMZMrDkgHByB6jTedx9m77bu3V4iPaGOLKeR7ups6Hs5/QylsxAW8SmzQaed5AOd5VeoF8Feudh W/SRf8wt6LmdKKeHuYla4TmVhmPQDnw4I7+m6Z1ryxPM2Oz0eadb2CrTR3Jrrwt9e/7A=; 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 1vgl6U-0002G8-7h for linux-f2fs-devel@lists.sourceforge.net; Fri, 16 Jan 2026 14:47:10 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id A794360160; Fri, 16 Jan 2026 14:46:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35DEBC16AAE; Fri, 16 Jan 2026 14:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768574819; bh=WULodj3ndaifHU9DlNb0w1E7YxSNfz8+hYky6+hNjMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mtsgnLatpOhe9kqnWRHmZwh5A/3hgyDsPKkyHY1PRTvRlU0+eOT7hKDZl0wG7WStN 3m33Rr/NxbHIy9fFYQBIqBlW6GdFXOP7tkP+DzN6zMLC2ntO8zB0C6vCIKJMpdTq+e VmkVEXX7M6qhXS7lcMKs+jvKtJQcqIkqpPfTOEZJhyrxximK0XcjOHxHcJGcOYtOTj aUDhA4bvmAp+TA4pLoqSw1vheM1ZHepi29vIdezq8hIBnYs8eP6kE/GnP8hFVe87Z1 1vY/Xi/Yl0fWVfDxWZmdomVLtBfaV2nFDDR3ZT1niuIxMgBf0Ubjfs+t9Q6dBHqOwU Ya4whlE0UUDDA== To: Al Viro , Christian Brauner , Jan Kara Date: Fri, 16 Jan 2026 09:46:15 -0500 Message-ID: <20260116144616.2098618-17-cel@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260116144616.2098618-1-cel@kernel.org> References: <20260116144616.2098618-1-cel@kernel.org> MIME-Version: 1.0 X-Headers-End: 1vgl6U-0002G8-7h Subject: [f2fs-dev] [PATCH v5 16/16] ksmbd: Report filesystem case sensitivity via FS_ATTRIBUTE_INFORMATION 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 ksmbd hard-codes FILE_CASE_SENSITIVE_SEARCH and FILE_CASE_PRESERVED_NAMES in FS_ATTRIBUTE_INFORMATION responses, incorrectly indicating all exports are case-sensitive. This breaks clients accessing case-insensitive filesystems like exFAT or ext4/f2fs directories with casefold enabled. Query actual case behavior via vfs_fileattr_get() and report accurate attributes to SMB clients. Filesystems without ->fileattr_get continue reporting default POSIX behavior (case-sensitive, case-preserving). SMB's FS_ATTRIBUTE_INFORMATION reports per-share attributes from the share root, not per-file. Shares mixing casefold and non-casefold directories report the root directory's behavior. Acked-by: Namjae Jeon Signed-off-by: Chuck Lever --- fs/smb/server/smb2pdu.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index 2fcd0d4d1fb0..f579093bb418 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "glob.h" #include "smbfsctl.h" @@ -5486,16 +5487,28 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work, case FS_ATTRIBUTE_INFORMATION: { FILE_SYSTEM_ATTRIBUTE_INFO *info; + struct file_kattr fa = {}; size_t sz; + u32 attrs; + int err; info = (FILE_SYSTEM_ATTRIBUTE_INFO *)rsp->Buffer; - info->Attributes = cpu_to_le32(FILE_SUPPORTS_OBJECT_IDS | - FILE_PERSISTENT_ACLS | - FILE_UNICODE_ON_DISK | - FILE_CASE_PRESERVED_NAMES | - FILE_CASE_SENSITIVE_SEARCH | - FILE_SUPPORTS_BLOCK_REFCOUNTING); + attrs = FILE_SUPPORTS_OBJECT_IDS | + FILE_PERSISTENT_ACLS | + FILE_UNICODE_ON_DISK | + FILE_SUPPORTS_BLOCK_REFCOUNTING; + err = vfs_fileattr_get(path.dentry, &fa); + if (err && err != -ENOIOCTLCMD) { + path_put(&path); + return err; + } + if (!fa.case_insensitive) + attrs |= FILE_CASE_SENSITIVE_SEARCH; + if (!fa.case_nonpreserving) + attrs |= FILE_CASE_PRESERVED_NAMES; + + info->Attributes = cpu_to_le32(attrs); info->Attributes |= cpu_to_le32(server_conf.share_fake_fscaps); if (test_share_config_flag(work->tcon->share_conf, -- 2.52.0 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel