Skip to content

Commit

Permalink
cifs: helper function to check replayable error codes
Browse files Browse the repository at this point in the history
[ Upstream commit 64cc377 ]

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>
  • Loading branch information
sprasad-microsoft authored and gregkh committed Mar 1, 2024
1 parent c09de6b commit f642fcf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions fs/smb/client/cached_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
atomic_inc(&tcon->num_remote_opens);
}
kfree(utf16_path);

return rc;
}

Expand Down
7 changes: 7 additions & 0 deletions fs/smb/client/cifsglob.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f642fcf

Please sign in to comment.