Skip to content

Commit 8767cb3

Browse files
committed
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: <[email protected]> Fixes: 6c06be9 ("cifs: Check if server supports reparse points before using them") Acked-by: Ralph Boehme <[email protected]> Acked-by: Paulo Alcantara (Red Hat) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 83898e4 commit 8767cb3

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
@@ -5260,7 +5260,8 @@ static int smb2_make_node(unsigned int xid, struct inode *inode,
52605260
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
52615261
rc = cifs_sfu_make_node(xid, inode, dentry, tcon,
52625262
full_path, mode, dev);
5263-
} else if (le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS) {
5263+
} else if ((le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS)
5264+
|| (tcon->posix_extensions)) {
52645265
rc = smb2_mknod_reparse(xid, inode, dentry, tcon,
52655266
full_path, mode, dev);
52665267
}

0 commit comments

Comments
 (0)