Skip to content

Commit 1244b88

Browse files
smfrenchedoardocanepa
authored andcommitted
Fix SMB311 posix special file creation to servers which do not advertise reparse support
BugLink: https://bugs.launchpad.net/bugs/2123805 commit 8767cb3fbd514c4cf85b4f516ca30388e846f540 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: 6c06be908ca19 ("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]> Signed-off-by: Noah Wager <[email protected]> Signed-off-by: Edoardo Canepa <[email protected]>
1 parent 9c43f60 commit 1244b88

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
@@ -1279,7 +1279,8 @@ struct inode *smb2_get_reparse_inode(struct cifs_open_info_data *data,
12791279
* empty object on the server.
12801280
*/
12811281
if (!(le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS))
1282-
return ERR_PTR(-EOPNOTSUPP);
1282+
if (!tcon->posix_extensions)
1283+
return ERR_PTR(-EOPNOTSUPP);
12831284

12841285
oparms = CIFS_OPARMS(cifs_sb, tcon, full_path,
12851286
SYNCHRONIZE | DELETE |

fs/smb/client/smb2ops.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5259,7 +5259,8 @@ static int smb2_make_node(unsigned int xid, struct inode *inode,
52595259
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
52605260
rc = cifs_sfu_make_node(xid, inode, dentry, tcon,
52615261
full_path, mode, dev);
5262-
} else if (le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS) {
5262+
} else if ((le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS)
5263+
|| (tcon->posix_extensions)) {
52635264
rc = smb2_mknod_reparse(xid, inode, dentry, tcon,
52645265
full_path, mode, dev);
52655266
}

0 commit comments

Comments
 (0)