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@xxxxxxxxxx> --- 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