Skip to content

Commit 5b432ae

Browse files
pcacjrsmfrench
authored andcommitted
smb: client: fix creating symlinks under POSIX mounts
SMB3.1.1 POSIX mounts support native symlinks that are created with IO_REPARSE_TAG_SYMLINK reparse points, so skip the checking of FILE_SUPPORTS_REPARSE_POINTS as some servers might not have it set. Cc: [email protected] Cc: Ralph Boehme <[email protected]> Cc: David Howells <[email protected]> Cc: <[email protected]> Reported-by: Matthew Richardson <[email protected]> Closes: https://marc.info/[email protected] Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 6b44530 commit 5b432ae

6 files changed

Lines changed: 13 additions & 10 deletions

File tree

fs/smb/client/cifsglob.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,4 +2377,9 @@ static inline bool cifs_netbios_name(const char *name, size_t namelen)
23772377
return ret;
23782378
}
23792379

2380+
#define CIFS_REPARSE_SUPPORT(tcon) \
2381+
((tcon)->posix_extensions || \
2382+
(le32_to_cpu((tcon)->fsAttrInfo.Attributes) & \
2383+
FILE_SUPPORTS_REPARSE_POINTS))
2384+
23802385
#endif /* _CIFS_GLOB_H */

fs/smb/client/cifssmb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2751,7 +2751,7 @@ int cifs_query_reparse_point(const unsigned int xid,
27512751
if (cap_unix(tcon->ses))
27522752
return -EOPNOTSUPP;
27532753

2754-
if (!(le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS))
2754+
if (!CIFS_REPARSE_SUPPORT(tcon))
27552755
return -EOPNOTSUPP;
27562756

27572757
oparms = (struct cifs_open_parms) {
@@ -2879,7 +2879,7 @@ struct inode *cifs_create_reparse_inode(struct cifs_open_info_data *data,
28792879
* attempt to create reparse point. This will prevent creating unusable
28802880
* empty object on the server.
28812881
*/
2882-
if (!(le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS))
2882+
if (!CIFS_REPARSE_SUPPORT(tcon))
28832883
return ERR_PTR(-EOPNOTSUPP);
28842884

28852885
#ifndef CONFIG_CIFS_XATTR

fs/smb/client/link.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ cifs_symlink(struct mnt_idmap *idmap, struct inode *inode,
635635
case CIFS_SYMLINK_TYPE_NATIVE:
636636
case CIFS_SYMLINK_TYPE_NFS:
637637
case CIFS_SYMLINK_TYPE_WSL:
638-
if (le32_to_cpu(pTcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS) {
638+
if (CIFS_REPARSE_SUPPORT(pTcon)) {
639639
rc = create_reparse_symlink(xid, inode, direntry, pTcon,
640640
full_path, symname);
641641
goto symlink_exit;

fs/smb/client/smb1ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ cifs_make_node(unsigned int xid, struct inode *inode,
12721272
*/
12731273
return cifs_sfu_make_node(xid, inode, dentry, tcon,
12741274
full_path, mode, dev);
1275-
} else if (le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS) {
1275+
} else if (CIFS_REPARSE_SUPPORT(tcon)) {
12761276
/*
12771277
* mknod via reparse points requires server support for
12781278
* storing reparse points, which is available since

fs/smb/client/smb2inode.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,9 +1346,8 @@ struct inode *smb2_create_reparse_inode(struct cifs_open_info_data *data,
13461346
* attempt to create reparse point. This will prevent creating unusable
13471347
* empty object on the server.
13481348
*/
1349-
if (!(le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS))
1350-
if (!tcon->posix_extensions)
1351-
return ERR_PTR(-EOPNOTSUPP);
1349+
if (!CIFS_REPARSE_SUPPORT(tcon))
1350+
return ERR_PTR(-EOPNOTSUPP);
13521351

13531352
oparms = CIFS_OPARMS(cifs_sb, tcon, full_path,
13541353
SYNCHRONIZE | DELETE |

fs/smb/client/smb2ops.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5260,10 +5260,9 @@ 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)
5264-
|| (tcon->posix_extensions)) {
5263+
} else if (CIFS_REPARSE_SUPPORT(tcon)) {
52655264
rc = mknod_reparse(xid, inode, dentry, tcon,
5266-
full_path, mode, dev);
5265+
full_path, mode, dev);
52675266
}
52685267
return rc;
52695268
}

0 commit comments

Comments
 (0)