Re: [PATCH 11/14] cifs: handle when server starts supporting multichannel

Paulo Alcantara
2023-11-02T20:28:32Z

nspmangalore@gmail.com writes:

> @@ -307,17 +308,41 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
> tcon->need_reopen_files = true;
>
> rc = cifs_tree_connect(0, tcon, nls_codepage);
> - mutex_unlock(&ses->session_mutex);
>
> cifs_dbg(FYI, "reconnect tcon rc = %d\n", rc);
> if (rc) {
> /* If sess reconnected but tcon didn't, something strange ... */
> + mutex_unlock(&ses->session_mutex);
> cifs_dbg(VFS, "reconnect tcon failed rc = %d\n", rc);
> goto out;
> }
>
> - if (smb2_command != SMB2_INTERNAL_CMD)
> - mod_delayed_work(cifsiod_wq, &server->reconnect, 0);
> + 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_dbg(VFS, "server %s supports multichannel now\n",
> + ses->server->hostname);

Sorry, forgot to mention that you should call cifs_dbg_server() which
protects access of @server->hostname as cifsd thread could have it freed
before you access it.