Skip to contentSkip to conversation

Fix SMB311 posix special file creation to servers which do not advertise reparse support

PATCH In review Ahmet Eray Karadag 3 participants 3 messages Jul 20, 2025 – Jul 21, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix SMB311 posix special file creation to servers which do not advertise reparse support

From: Steve French <[email protected]>

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).

Fixes 6c06be908ca19 ("cifs: Check if server supports reparse points before using them")
---
 fs/smb/client/smb2inode.c | 3 ++-
 fs/smb/client/smb2ops.c   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
fs/smb/client/smb2inode.c +2 -1
index 2a3e46b8e15a..a11a2a693c51 100644
@@ -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 |
fs/smb/client/smb2ops.c +2 -1
index cb659256d219..938a8a7c5d21 100644
@@ -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);
 	}
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 59 lines · Ahmet Eray Karadag

From: Steve French <[email protected]>

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).

Fixes 6c06be908ca19 ("cifs: Check if server supports reparse points before using them")
---
 fs/smb/client/smb2inode.c | 3 ++-
 fs/smb/client/smb2ops.c   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
fs/smb/client/smb2inode.c +2 -1
index 2a3e46b8e15a..a11a2a693c51 100644
@@ -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 |
fs/smb/client/smb2ops.c +2 -1
index cb659256d219..938a8a7c5d21 100644
@@ -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);
 	}
Signature · 1 line
2.34.1

<formletter>

This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

maintainer Acked-by Ralph Boehme Acked-by Paulo Alcantara (Red Hat) on v1 1/1
#2 lore raw
In reply to Ahmet Eray Karadag

[ Sasha's backport helper bot ]

Hi,

Summary of potential issues:
❌ Patch application failures detected
⚠️ Found matching upstream commit but patch is missing proper reference to it

Found matching upstream commit: 8767cb3fbd514c4cf85b4f516ca30388e846f540

WARNING: Author mismatch between patch and found commit:
Backport author: Ahmet Eray Karadag <[email protected]> Commit author: Steve French <[email protected]>

Note: The patch differs from the upstream commit:
---
1: 8767cb3fbd51 ! 1: db704f6b22b4 Fix SMB311 posix special file creation to servers which do not advertise reparse support
@@ Commit message

+ Signed-off-by: Ahmet Eray Karadag <[email protected]>

## fs/smb/client/smb2inode.c ##
@@ fs/smb/client/smb2inode.c: struct inode *smb2_get_reparse_inode(struct cifs_open_info_data *data,

---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| origin/linux-6.15.y       | Success     | Success    |
| origin/linux-6.12.y       | Failed      | N/A        |
| origin/linux-6.6.y        | Failed      | N/A        |
| origin/linux-6.1.y        | Failed      | N/A        |
| origin/linux-5.15.y       | Failed      | N/A        |
| origin/linux-5.10.y       | Failed      | N/A        |
| origin/linux-5.4.y        | Failed      | N/A        |