Skip to content

Commit 6f8a394

Browse files
paliSteve French
authored andcommitted
cifs: Ensure that all non-client-specific reparse points are processed by the server
Fix regression in mounts to e.g. onedrive shares. Generally, reparse points are processed by the SMB server during the SMB OPEN request, but there are few reparse points which do not have OPEN-like meaning for the SMB server and has to be processed by the SMB client. Those are symlinks and special files (fifo, socket, block, char). For Linux SMB client, it is required to process also name surrogate reparse points as they represent another entity on the SMB server system. Linux client will mark them as separate mount points. Examples of name surrogate reparse points are NTFS junction points (e.g. created by the "mklink" tool on Windows servers). So after processing the name surrogate reparse points, clear the -EOPNOTSUPP error code returned from the parse_reparse_point() to let SMB server to process reparse points. And remove printing misleading error message "unhandled reparse tag:" as reparse points are handled by SMB server and hence unhandled fact is normal operation. Fixes: cad3fc0 ("cifs: Throw -EOPNOTSUPP error on unsupported reparse point type from parse_reparse_point()") Fixes: b587fd1 ("cifs: Treat unhandled directory name surrogate reparse points as mount directory nodes") Cc: stable@vger.kernel.org Reported-by: Junwen Sun <sunjw8888@gmail.com> Tested-by: Junwen Sun <sunjw8888@gmail.com> Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 0af2f6b commit 6f8a394

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

fs/smb/client/inode.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,16 @@ static int reparse_info_to_fattr(struct cifs_open_info_data *data,
12281228
cifs_create_junction_fattr(fattr, sb);
12291229
goto out;
12301230
}
1231+
/*
1232+
* If the reparse point is unsupported by the Linux SMB
1233+
* client then let it process by the SMB server. So mask
1234+
* the -EOPNOTSUPP error code. This will allow Linux SMB
1235+
* client to send SMB OPEN request to server. If server
1236+
* does not support this reparse point too then server
1237+
* will return error during open the path.
1238+
*/
1239+
if (rc == -EOPNOTSUPP)
1240+
rc = 0;
12311241
}
12321242

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

fs/smb/client/reparse.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,8 +1062,6 @@ int parse_reparse_point(struct reparse_data_buffer *buf,
10621062
const char *full_path,
10631063
struct cifs_open_info_data *data)
10641064
{
1065-
struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
1066-
10671065
data->reparse.buf = buf;
10681066

10691067
/* See MS-FSCC 2.1.2 */
@@ -1090,8 +1088,6 @@ int parse_reparse_point(struct reparse_data_buffer *buf,
10901088
}
10911089
return 0;
10921090
default:
1093-
cifs_tcon_dbg(VFS | ONCE, "unhandled reparse tag: 0x%08x\n",
1094-
le32_to_cpu(buf->ReparseTag));
10951091
return -EOPNOTSUPP;
10961092
}
10971093
}

0 commit comments

Comments
 (0)