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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
---
 fs/smb/client/smb2ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
-- 
2.40.1




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux