Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH][SMB3 client] Fix SMB311 posix special file creation to servers which do not advertise reparse support
@ 2025-07-15  3:31 Steve French
  2025-07-15  5:18 ` Ralph Boehme
  0 siblings, 1 reply; 2+ messages in thread
From: Steve French @ 2025-07-15  3:31 UTC (permalink / raw)
  To: CIFS; +Cc: samba-technical, Paulo Alcantara

[-- Attachment #1: Type: text/plain, Size: 1036 bytes --]

Some servers (including Samba), support the SMB3.1.1 POSIX Extensions
(which use reparse
points for handling special files) but do not properly advertise file
system attribute
FILE_SUPPORTS_REPARSE_POINTS.  Although we don't check for this
attribute flag when
querying special file information, we do check it when creating
special files which
causes them to fail unnecessarily.   If we have negotiated SMB3.1.1
POSIX Extensions
with the server we can expect the server to support creating special files via
reparse points, and even if the server fails the operation due to
really forbidding
creating special files, then it should be no problem and is more
likely to return a
more accurate rc in any case (e.g. EACCES instead of EOPNOTSUPP).

Allow creating special files as long as the server supports either
reparse points
or the SMB3.1.1 POSIX Extensions (note that if the "sfu" mount option
is specified
it uses a different way of storing special files that does not rely on
reparse points).

See attached patch

-- 
Thanks,

Steve

[-- Attachment #2: 0001-Fix-SMB311-posix-special-file-creation-to-servers-wh.patch --]
[-- Type: text/x-patch, Size: 2724 bytes --]

From 4e1c9118ea62c52f70ca2c3949d095096c4eb666 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Mon, 14 Jul 2025 22:16:19 -0500
Subject: [PATCH] Fix SMB311 posix special file creation to servers which do
 not advertise reparse support

Some servers (including Samba), support the SMB3.1.1 POSIX Extensions (which use reparse
points for handling special files) but do not properly advertise file system attribute
FILE_SUPPORTS_REPARSE_POINTS.  Although we don't check for this attribute flag when
querying special file information, we do check it when creating special files which
causes them to fail unnecessarily.   If we have negotiated SMB3.1.1 POSIX Extensions
with the server we can expect the server to support creating special files via
reparse points, and even if the server fails the operation due to really forbidding
creating special files, then it should be no problem and is more likely to return a
more accurate rc in any case (e.g. EACCES instead of EOPNOTSUPP).

Allow creating special files as long as the server supports either reparse points
or the SMB3.1.1 POSIX Extensions (note that if the "sfu" mount option is specified
it uses a different way of storing special files that does not rely on reparse points).

Cc: <stable@vger.kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/smb/client/smb2inode.c | 3 ++-
 fs/smb/client/smb2ops.c   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c
index 2a3e46b8e15a..a11a2a693c51 100644
--- a/fs/smb/client/smb2inode.c
+++ b/fs/smb/client/smb2inode.c
@@ -1346,7 +1346,8 @@ struct inode *smb2_get_reparse_inode(struct cifs_open_info_data *data,
 	 * empty object on the server.
 	 */
 	if (!(le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS))
-		return ERR_PTR(-EOPNOTSUPP);
+		if (!tcon->posix_extensions)
+			return ERR_PTR(-EOPNOTSUPP);
 
 	oparms = CIFS_OPARMS(cifs_sb, tcon, full_path,
 			     SYNCHRONIZE | DELETE |
diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
index cb659256d219..938a8a7c5d21 100644
--- a/fs/smb/client/smb2ops.c
+++ b/fs/smb/client/smb2ops.c
@@ -5260,7 +5260,8 @@ static int smb2_make_node(unsigned int xid, struct inode *inode,
 	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
 		rc = cifs_sfu_make_node(xid, inode, dentry, tcon,
 					full_path, mode, dev);
-	} else if (le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS) {
+	} else if ((le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS)
+		|| (tcon->posix_extensions)) {
 		rc = smb2_mknod_reparse(xid, inode, dentry, tcon,
 					full_path, mode, dev);
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-15  5:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-15  3:31 [PATCH][SMB3 client] Fix SMB311 posix special file creation to servers which do not advertise reparse support Steve French
2025-07-15  5:18 ` Ralph Boehme

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox