Skip to content

Commit 2f3d117

Browse files
smfrenchgregkh
authored andcommitted
Fix SMB311 posix special file creation to servers which do not advertise reparse support
commit 8767cb3 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5dfbdc9 commit 2f3d117

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
@@ -5246,7 +5246,8 @@ static int smb2_make_node(unsigned int xid, struct inode *inode,
52465246
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
52475247
rc = cifs_sfu_make_node(xid, inode, dentry, tcon,
52485248
full_path, mode, dev);
5249-
} else if (le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS) {
5249+
} else if ((le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS)
5250+
|| (tcon->posix_extensions)) {
52505251
rc = smb2_mknod_reparse(xid, inode, dentry, tcon,
52515252
full_path, mode, dev);
52525253
}

0 commit comments

Comments
 (0)