[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241231223514.15595-3-pali@kernel.org>
Date: Tue, 31 Dec 2024 23:35:12 +0100
From: Pali Rohár <pali@...nel.org>
To: Steve French <sfrench@...ba.org>,
Paulo Alcantara <pc@...guebit.com>
Cc: linux-cifs@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 3/5] cifs: Improve SMB2+ stat() to work also on non-present name surrogate reparse points
SMB server returns STATUS_OBJECT_PATH_NOT_FOUND if the path exists, is the
reparse point of name surrogate type (e.g. mount point) and surrogate
target location does not exist.
So if the server returns STATUS_OBJECT_PATH_NOT_FOUND error then it is
required to send request again with OPEN_REPARSE_POINT flag. This is needed
to distinguish between path does not exist and path exists and points to
non-existent surrogate location.
Before this change, Linux SMB client returned for non-present name
surrogate reparse point -ENOENT error. With this change it correctly
returns that the entry exits, it is of directory type with filled stat
information.
Signed-off-by: Pali Rohár <pali@...nel.org>
---
fs/smb/client/smb2inode.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c
index 0b8d6d8f724d..b6342b043073 100644
--- a/fs/smb/client/smb2inode.c
+++ b/fs/smb/client/smb2inode.c
@@ -958,6 +958,18 @@ int smb2_query_path_info(const unsigned int xid,
if (!hdr || out_buftype[0] == CIFS_NO_BUFFER)
goto out;
+ /*
+ * SMB server returns STATUS_OBJECT_PATH_NOT_FOUND if the path exists,
+ * is the reparse point of name surrogate type (e.g. mount point) and
+ * surrogate target location does not exist.
+ * So if the server returns STATUS_OBJECT_PATH_NOT_FOUND error then it
+ * is required to send request again with OPEN_REPARSE_POINT flag.
+ * Re-opening with OPEN_REPARSE_POINT is done in the case when rc is
+ * -EOPNOTSUPP.
+ */
+ if (hdr->Status == STATUS_OBJECT_PATH_NOT_FOUND)
+ rc = -EOPNOTSUPP;
+
switch (rc) {
case 0:
rc = parse_create_response(data, cifs_sb, full_path, &out_iov[0]);
--
2.20.1
Powered by blists - more mailing lists