diff mbox series

[3/3] cifs: add signal check in the loop in smb2_get_dfs_refer()

Message ID 20230629085858.2834937-3-wentao@uniontech.com
State New
Headers show
Series [1/3] cifs: fix credit leaks in async callback | expand

Commit Message

Winston Wen June 29, 2023, 8:58 a.m. UTC
If a process has a pending fatal signal, the request will not be sent in
__smb_send_rqst(), but will return -ERESTARTSYS instead.

In the loop in smb2_get_dfs_refer(), -ERESTARTSYS returned from
SMB_ioctl will cause an retry that still can't succeed and will do some
unnecessary work, like allocating/releasing buffer, getting/adding
credits.

So let us add signal check in the loop to avoid unnecessary retries and
return faster.

Signed-off-by: Winston Wen <wentao@uniontech.com>
---
 fs/smb/client/smb2ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
index eb1340b9125e..64f78e1b5ea7 100644
--- a/fs/smb/client/smb2ops.c
+++ b/fs/smb/client/smb2ops.c
@@ -2818,7 +2818,7 @@  smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
 				FSCTL_DFS_GET_REFERRALS,
 				(char *)dfs_req, dfs_req_size, CIFSMaxBufSize,
 				(char **)&dfs_rsp, &dfs_rsp_size);
-		if (!is_retryable_error(rc))
+		if (!is_retryable_error(rc) || fatal_signal_pending(current))
 			break;
 		usleep_range(512, 2048);
 	} while (++retry_count < 5);