Skip to content

Commit b587fd1

Browse files
paliSteve French
authored andcommitted
cifs: Treat unhandled directory name surrogate reparse points as mount directory nodes
If the reparse point was not handled (indicated by the -EOPNOTSUPP from ops->parse_reparse_point() call) but reparse tag is of type name surrogate directory type, then treat is as a new mount point. Name surrogate reparse point represents another named entity in the system. From SMB client point of view, this another entity is resolved on the SMB server, and server serves its content automatically. Therefore from Linux client point of view, this name surrogate reparse point of directory type crosses mount point. Signed-off-by: Pali Rohár <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent cad3fc0 commit b587fd1

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

fs/smb/client/inode.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,19 @@ static int reparse_info_to_fattr(struct cifs_open_info_data *data,
12151215
rc = server->ops->parse_reparse_point(cifs_sb,
12161216
full_path,
12171217
iov, data);
1218+
/*
1219+
* If the reparse point was not handled but it is the
1220+
* name surrogate which points to directory, then treat
1221+
* is as a new mount point. Name surrogate reparse point
1222+
* represents another named entity in the system.
1223+
*/
1224+
if (rc == -EOPNOTSUPP &&
1225+
IS_REPARSE_TAG_NAME_SURROGATE(data->reparse.tag) &&
1226+
(le32_to_cpu(data->fi.Attributes) & ATTR_DIRECTORY)) {
1227+
rc = 0;
1228+
cifs_create_junction_fattr(fattr, sb);
1229+
goto out;
1230+
}
12181231
}
12191232

12201233
if (data->reparse.tag == IO_REPARSE_TAG_SYMLINK && !rc) {

fs/smb/common/smbfsctl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@
159159
#define IO_REPARSE_TAG_LX_CHR 0x80000025
160160
#define IO_REPARSE_TAG_LX_BLK 0x80000026
161161

162+
/* If Name Surrogate Bit is set, the file or directory represents another named entity in the system. */
163+
#define IS_REPARSE_TAG_NAME_SURROGATE(tag) (!!((tag) & 0x20000000))
164+
162165
/* fsctl flags */
163166
/* If Flags is set to this value, the request is an FSCTL not ioctl request */
164167
#define SMB2_0_IOCTL_IS_FSCTL 0x00000001

0 commit comments

Comments
 (0)