@@ -578,7 +578,7 @@ static int cifs_query_path_info(const unsigned int xid,
* so they cannot be used for querying paths with wildcard characters.
* Therefore for such paths returns -ENOENT as they cannot exist.
*/
- if ((rc == -EOPNOTSUPP || rc == -EINVAL) &&
+ if ((rc == -EOPNOTSUPP || rc == -EINVAL || rc == -EBUSY) &&
!(tcon->ses->capabilities & CAP_UNICODE) &&
strpbrk(full_path, "*?\"><"))
rc = -ENOENT;
@@ -587,7 +587,7 @@ static int cifs_query_path_info(const unsigned int xid,
* Then fallback to CIFSFindFirst() which works also with non-NT servers
* but does not does not provide NumberOfLinks.
*/
- if (rc == -EOPNOTSUPP || rc == -EINVAL) {
+ if (rc == -EOPNOTSUPP || rc == -EINVAL || rc == -EBUSY) {
search_info.info_level = SMB_FIND_FILE_FULL_DIRECTORY_INFO;
rc = CIFSFindFirst(xid, tcon, full_path, cifs_sb, NULL,
CIFS_SEARCH_CLOSE_ALWAYS | CIFS_SEARCH_CLOSE_AT_END,
Windows NT SMB server may return -EBUSY (STATUS_DELETE_PENDING) from CIFSSMBQPathInfo() function for files which are in DELETE_PENDING state. When this happens, it is still possible to use CIFSFindFirst() fallback. So allow to use CIFSFindFirst() fallback also for -EBUSY error. This change fixed stat() to work also against Windows Server 2022 for files in DELETE_PENDING state. Signed-off-by: Pali Rohár <pali@kernel.org> --- fs/smb/client/smb1ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)