aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGermano Percossi <germano.percossi@citrix.com>2017-04-07 07:29:36 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-21 03:31:19 -0400
commit3d8d2f2344767cbab597027e2cde21d1a8b32cca (patch)
tree86e2047e9141d54ba333b1a7b569cd06fdb594dd
parentfd3be7eaff1441cbc5c0a3abf50b519d721d6c0c (diff)
CIFS: reconnect thread reschedule itself
commit 18ea43113f5b74a97dd4be9bddbac10d68b1a6ce upstream. In case of error, smb2_reconnect_server reschedule itself with a delay, to avoid being too aggressive. Signed-off-by: Germano Percossi <germano.percossi@citrix.com> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com> Signed-off-by: Steve French <smfrench@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/cifs/smb2pdu.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index bdd32925a15e..7080dac3592c 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1987,6 +1987,9 @@ void smb2_reconnect_server(struct work_struct *work)
1987 struct cifs_tcon *tcon, *tcon2; 1987 struct cifs_tcon *tcon, *tcon2;
1988 struct list_head tmp_list; 1988 struct list_head tmp_list;
1989 int tcon_exist = false; 1989 int tcon_exist = false;
1990 int rc;
1991 int resched = false;
1992
1990 1993
1991 /* Prevent simultaneous reconnects that can corrupt tcon->rlist list */ 1994 /* Prevent simultaneous reconnects that can corrupt tcon->rlist list */
1992 mutex_lock(&server->reconnect_mutex); 1995 mutex_lock(&server->reconnect_mutex);
@@ -2014,13 +2017,18 @@ void smb2_reconnect_server(struct work_struct *work)
2014 spin_unlock(&cifs_tcp_ses_lock); 2017 spin_unlock(&cifs_tcp_ses_lock);
2015 2018
2016 list_for_each_entry_safe(tcon, tcon2, &tmp_list, rlist) { 2019 list_for_each_entry_safe(tcon, tcon2, &tmp_list, rlist) {
2017 if (!smb2_reconnect(SMB2_INTERNAL_CMD, tcon)) 2020 rc = smb2_reconnect(SMB2_INTERNAL_CMD, tcon);
2021 if (!rc)
2018 cifs_reopen_persistent_handles(tcon); 2022 cifs_reopen_persistent_handles(tcon);
2023 else
2024 resched = true;
2019 list_del_init(&tcon->rlist); 2025 list_del_init(&tcon->rlist);
2020 cifs_put_tcon(tcon); 2026 cifs_put_tcon(tcon);
2021 } 2027 }
2022 2028
2023 cifs_dbg(FYI, "Reconnecting tcons finished\n"); 2029 cifs_dbg(FYI, "Reconnecting tcons finished\n");
2030 if (resched)
2031 queue_delayed_work(cifsiod_wq, &server->reconnect, 2 * HZ);
2024 mutex_unlock(&server->reconnect_mutex); 2032 mutex_unlock(&server->reconnect_mutex);
2025 2033
2026 /* now we can safely release srv struct */ 2034 /* now we can safely release srv struct */