Commit 18ea4311 authored by Germano Percossi's avatar Germano Percossi Committed by Steve French

CIFS: reconnect thread reschedule itself

In case of error, smb2_reconnect_server reschedule itself
with a delay, to avoid being too aggressive.
Signed-off-by: default avatarGermano Percossi <germano.percossi@citrix.com>
Reviewed-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
CC: Stable <stable@vger.kernel.org>
Signed-off-by: default avatarSteve French <smfrench@gmail.com>
parent 40920c2b
...@@ -2181,6 +2181,9 @@ void smb2_reconnect_server(struct work_struct *work) ...@@ -2181,6 +2181,9 @@ void smb2_reconnect_server(struct work_struct *work)
struct cifs_tcon *tcon, *tcon2; struct cifs_tcon *tcon, *tcon2;
struct list_head tmp_list; struct list_head tmp_list;
int tcon_exist = false; int tcon_exist = false;
int rc;
int resched = false;
/* Prevent simultaneous reconnects that can corrupt tcon->rlist list */ /* Prevent simultaneous reconnects that can corrupt tcon->rlist list */
mutex_lock(&server->reconnect_mutex); mutex_lock(&server->reconnect_mutex);
...@@ -2208,13 +2211,18 @@ void smb2_reconnect_server(struct work_struct *work) ...@@ -2208,13 +2211,18 @@ void smb2_reconnect_server(struct work_struct *work)
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
list_for_each_entry_safe(tcon, tcon2, &tmp_list, rlist) { list_for_each_entry_safe(tcon, tcon2, &tmp_list, rlist) {
if (!smb2_reconnect(SMB2_INTERNAL_CMD, tcon)) rc = smb2_reconnect(SMB2_INTERNAL_CMD, tcon);
if (!rc)
cifs_reopen_persistent_handles(tcon); cifs_reopen_persistent_handles(tcon);
else
resched = true;
list_del_init(&tcon->rlist); list_del_init(&tcon->rlist);
cifs_put_tcon(tcon); cifs_put_tcon(tcon);
} }
cifs_dbg(FYI, "Reconnecting tcons finished\n"); cifs_dbg(FYI, "Reconnecting tcons finished\n");
if (resched)
queue_delayed_work(cifsiod_wq, &server->reconnect, 2 * HZ);
mutex_unlock(&server->reconnect_mutex); mutex_unlock(&server->reconnect_mutex);
/* now we can safely release srv struct */ /* now we can safely release srv struct */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment