Commit 705fc522 authored by Shyam Prasad N's avatar Shyam Prasad N Committed by Steve French

cifs: handle when server starts supporting multichannel

When the user mounts with multichannel option, but the
server does not support it, there can be a time in future
where it can be supported.

With this change, such a case is handled.
Signed-off-by: default avatarShyam Prasad N <sprasad@microsoft.com>
parent 784e0e20
...@@ -132,6 +132,7 @@ extern int SendReceiveBlockingLock(const unsigned int xid, ...@@ -132,6 +132,7 @@ extern int SendReceiveBlockingLock(const unsigned int xid,
struct smb_hdr *in_buf, struct smb_hdr *in_buf,
struct smb_hdr *out_buf, struct smb_hdr *out_buf,
int *bytes_returned); int *bytes_returned);
void void
cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server, cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server,
bool all_channels); bool all_channels);
......
...@@ -132,6 +132,9 @@ static void smb2_query_server_interfaces(struct work_struct *work) ...@@ -132,6 +132,9 @@ static void smb2_query_server_interfaces(struct work_struct *work)
free_xid(xid); free_xid(xid);
if (rc) { if (rc) {
if (rc == -EOPNOTSUPP)
return;
cifs_dbg(FYI, "%s: failed to query server interfaces: %d\n", cifs_dbg(FYI, "%s: failed to query server interfaces: %d\n",
__func__, rc); __func__, rc);
} }
......
...@@ -163,6 +163,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon, ...@@ -163,6 +163,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
int rc = 0; int rc = 0;
struct nls_table *nls_codepage = NULL; struct nls_table *nls_codepage = NULL;
struct cifs_ses *ses; struct cifs_ses *ses;
int xid;
/* /*
* SMB2s NegProt, SessSetup, Logoff do not have tcon yet so * SMB2s NegProt, SessSetup, Logoff do not have tcon yet so
...@@ -307,17 +308,44 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon, ...@@ -307,17 +308,44 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
tcon->need_reopen_files = true; tcon->need_reopen_files = true;
rc = cifs_tree_connect(0, tcon, nls_codepage); rc = cifs_tree_connect(0, tcon, nls_codepage);
mutex_unlock(&ses->session_mutex);
cifs_dbg(FYI, "reconnect tcon rc = %d\n", rc); cifs_dbg(FYI, "reconnect tcon rc = %d\n", rc);
if (rc) { if (rc) {
/* If sess reconnected but tcon didn't, something strange ... */ /* If sess reconnected but tcon didn't, something strange ... */
mutex_unlock(&ses->session_mutex);
cifs_dbg(VFS, "reconnect tcon failed rc = %d\n", rc); cifs_dbg(VFS, "reconnect tcon failed rc = %d\n", rc);
goto out; goto out;
} }
if (!rc &&
(server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) {
mutex_unlock(&ses->session_mutex);
/*
* query server network interfaces, in case they change
*/
xid = get_xid();
rc = SMB3_request_interfaces(xid, tcon, false);
free_xid(xid);
if (rc)
cifs_dbg(FYI, "%s: failed to query server interfaces: %d\n",
__func__, rc);
if (ses->chan_max > ses->chan_count &&
!SERVER_IS_CHAN(server)) {
if (ses->chan_count == 1)
cifs_server_dbg(VFS, "supports multichannel now\n");
cifs_try_adding_channels(ses);
}
} else {
mutex_unlock(&ses->session_mutex);
}
if (smb2_command != SMB2_INTERNAL_CMD) if (smb2_command != SMB2_INTERNAL_CMD)
mod_delayed_work(cifsiod_wq, &server->reconnect, 0); if (mod_delayed_work(cifsiod_wq, &server->reconnect, 0))
cifs_put_tcp_session(server, false);
atomic_inc(&tconInfoReconnectCount); atomic_inc(&tconInfoReconnectCount);
out: out:
......
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