]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cifs: helper function to check replayable error codes
authorShyam Prasad N <sprasad@microsoft.com>
Sun, 21 Jan 2024 03:32:46 +0000 (03:32 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Mar 2024 12:34:49 +0000 (13:34 +0100)
[ Upstream commit 64cc377b7628b81ffdbdb1c6bacfba895dcac3f8 ]

The code to check for replay is not just -EAGAIN. In some
cases, the send request or receive response may result in
network errors, which we're now mapping to -ECONNABORTED.

This change introduces a helper function which checks
if the error returned in one of the above two errors.
And all checks for replays will now use this helper.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/smb/client/cached_dir.c
fs/smb/client/cifsglob.h

index 971892620504730e6e2265f50c54874f3d676eac..5730c65ffb40d278f4952896527ad4d556a8350c 100644 (file)
@@ -367,6 +367,7 @@ out:
                atomic_inc(&tcon->num_remote_opens);
        }
        kfree(utf16_path);
+
        return rc;
 }
 
index 942e6ece56b1a3e92b44b41c0828231ac844838a..f794b16095e43818f5816eb79ac0f24c1a384fa7 100644 (file)
@@ -1820,6 +1820,13 @@ static inline bool is_retryable_error(int error)
        return false;
 }
 
+static inline bool is_replayable_error(int error)
+{
+       if (error == -EAGAIN || error == -ECONNABORTED)
+               return true;
+       return false;
+}
+
 
 /* cifs_get_writable_file() flags */
 #define FIND_WR_ANY         0