]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
0244a5be1a5fbdd052d2545da64796f2dfe736c9
[thirdparty/kernel/stable-queue.git] /
1 From 6f8a394aa952257575910d57cf0a63627fa949a2 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
3 Date: Sat, 5 Apr 2025 19:51:07 +0200
4 Subject: cifs: Ensure that all non-client-specific reparse points are processed by the server
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 From: Pali Rohár <pali@kernel.org>
10
11 commit 6f8a394aa952257575910d57cf0a63627fa949a2 upstream.
12
13 Fix regression in mounts to e.g. onedrive shares.
14
15 Generally, reparse points are processed by the SMB server during the
16 SMB OPEN request, but there are few reparse points which do not have
17 OPEN-like meaning for the SMB server and has to be processed by the SMB
18 client. Those are symlinks and special files (fifo, socket, block, char).
19
20 For Linux SMB client, it is required to process also name surrogate reparse
21 points as they represent another entity on the SMB server system. Linux
22 client will mark them as separate mount points. Examples of name surrogate
23 reparse points are NTFS junction points (e.g. created by the "mklink" tool
24 on Windows servers).
25
26 So after processing the name surrogate reparse points, clear the
27 -EOPNOTSUPP error code returned from the parse_reparse_point() to let SMB
28 server to process reparse points.
29
30 And remove printing misleading error message "unhandled reparse tag:" as
31 reparse points are handled by SMB server and hence unhandled fact is normal
32 operation.
33
34 Fixes: cad3fc0a4c8c ("cifs: Throw -EOPNOTSUPP error on unsupported reparse point type from parse_reparse_point()")
35 Fixes: b587fd128660 ("cifs: Treat unhandled directory name surrogate reparse points as mount directory nodes")
36 Cc: stable@vger.kernel.org
37 Reported-by: Junwen Sun <sunjw8888@gmail.com>
38 Tested-by: Junwen Sun <sunjw8888@gmail.com>
39 Signed-off-by: Pali Rohár <pali@kernel.org>
40 Signed-off-by: Steve French <stfrench@microsoft.com>
41 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
42 ---
43 fs/smb/client/inode.c | 10 ++++++++++
44 fs/smb/client/reparse.c | 4 ----
45 2 files changed, 10 insertions(+), 4 deletions(-)
46
47 --- a/fs/smb/client/inode.c
48 +++ b/fs/smb/client/inode.c
49 @@ -1206,6 +1206,16 @@ static int reparse_info_to_fattr(struct
50 cifs_create_junction_fattr(fattr, sb);
51 goto out;
52 }
53 + /*
54 + * If the reparse point is unsupported by the Linux SMB
55 + * client then let it process by the SMB server. So mask
56 + * the -EOPNOTSUPP error code. This will allow Linux SMB
57 + * client to send SMB OPEN request to server. If server
58 + * does not support this reparse point too then server
59 + * will return error during open the path.
60 + */
61 + if (rc == -EOPNOTSUPP)
62 + rc = 0;
63 }
64 break;
65 }
66 --- a/fs/smb/client/reparse.c
67 +++ b/fs/smb/client/reparse.c
68 @@ -633,8 +633,6 @@ int parse_reparse_point(struct reparse_d
69 const char *full_path,
70 bool unicode, struct cifs_open_info_data *data)
71 {
72 - struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
73 -
74 data->reparse.buf = buf;
75
76 /* See MS-FSCC 2.1.2 */
77 @@ -658,8 +656,6 @@ int parse_reparse_point(struct reparse_d
78 }
79 return 0;
80 default:
81 - cifs_tcon_dbg(VFS | ONCE, "unhandled reparse tag: 0x%08x\n",
82 - le32_to_cpu(buf->ReparseTag));
83 return -EOPNOTSUPP;
84 }
85 }