Skip to content

Commit 449b26b

Browse files
committed
smb: client: fix creating symlinks under POSIX mounts
JIRA: https://issues.redhat.com/browse/RHEL-109507 commit 5b432ae Author: Paulo Alcantara <pc@manguebit.org> Date: Thu Jul 31 20:46:43 2025 -0300 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: linux-cifs@vger.kernel.org Cc: Ralph Boehme <slow@samba.org> Cc: David Howells <dhowells@redhat.com> Cc: <stable@vger.kernel.org> Reported-by: Matthew Richardson <m.richardson@ed.ac.uk> Closes: https://marc.info/?i=1124e7cd-6a46-40a6-9f44-b7664a66654b@ed.ac.uk Signed-off-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 1916a68 commit 449b26b

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

fs/smb/client/cifsglob.h

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

2415+
#define CIFS_REPARSE_SUPPORT(tcon) \
2416+
((tcon)->posix_extensions || \
2417+
(le32_to_cpu((tcon)->fsAttrInfo.Attributes) & \
2418+
FILE_SUPPORTS_REPARSE_POINTS))
2419+
24152420
#endif /* _CIFS_GLOB_H */

fs/smb/client/cifssmb.c

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

2695-
if (!(le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS))
2695+
if (!CIFS_REPARSE_SUPPORT(tcon))
26962696
return -EOPNOTSUPP;
26972697

26982698
oparms = (struct cifs_open_parms) {
@@ -2820,7 +2820,7 @@ struct inode *cifs_create_reparse_inode(struct cifs_open_info_data *data,
28202820
* attempt to create reparse point. This will prevent creating unusable
28212821
* empty object on the server.
28222822
*/
2823-
if (!(le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS))
2823+
if (!CIFS_REPARSE_SUPPORT(tcon))
28242824
return ERR_PTR(-EOPNOTSUPP);
28252825

28262826
#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
@@ -5203,10 +5203,9 @@ static int smb2_make_node(unsigned int xid, struct inode *inode,
52035203
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
52045204
rc = cifs_sfu_make_node(xid, inode, dentry, tcon,
52055205
full_path, mode, dev);
5206-
} else if ((le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS)
5207-
|| (tcon->posix_extensions)) {
5206+
} else if (CIFS_REPARSE_SUPPORT(tcon)) {
52085207
rc = mknod_reparse(xid, inode, dentry, tcon,
5209-
full_path, mode, dev);
5208+
full_path, mode, dev);
52105209
}
52115210
return rc;
52125211
}

0 commit comments

Comments
 (0)