Skip to content

Commit 2534061

Browse files
committed
Fix SMB311 posix special file creation to servers which do not advertise reparse support
JIRA: https://issues.redhat.com/browse/RHEL-104401 commit 8767cb3 Author: Steve French <stfrench@microsoft.com> Date: Mon Jul 14 22:16:19 2025 -0500 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> Fixes: 6c06be9 ("cifs: Check if server supports reparse points before using them") Acked-by: Ralph Boehme <slow@samba.org> Acked-by: Paulo Alcantara (Red Hat) <pc@manguebit.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Paulo Alcantara <paalcant@redhat.com>
1 parent 911dce8 commit 2534061

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

fs/smb/client/smb2inode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,8 @@ struct inode *smb2_get_reparse_inode(struct cifs_open_info_data *data,
13461346
* empty object on the server.
13471347
*/
13481348
if (!(le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS))
1349-
return ERR_PTR(-EOPNOTSUPP);
1349+
if (!tcon->posix_extensions)
1350+
return ERR_PTR(-EOPNOTSUPP);
13501351

13511352
oparms = CIFS_OPARMS(cifs_sb, tcon, full_path,
13521353
SYNCHRONIZE | DELETE |

fs/smb/client/smb2ops.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5195,7 +5195,8 @@ static int smb2_make_node(unsigned int xid, struct inode *inode,
51955195
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
51965196
rc = cifs_sfu_make_node(xid, inode, dentry, tcon,
51975197
full_path, mode, dev);
5198-
} else if (le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS) {
5198+
} else if ((le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS)
5199+
|| (tcon->posix_extensions)) {
51995200
rc = smb2_mknod_reparse(xid, inode, dentry, tcon,
52005201
full_path, mode, dev);
52015202
}

0 commit comments

Comments
 (0)