]> git.itanic.dy.fi Git - linux-stable/commitdiff
cifs: do not duplicate fscache cookie for secondary channels
authorShyam Prasad N <sprasad@microsoft.com>
Mon, 19 Jul 2021 13:59:14 +0000 (13:59 +0000)
committerSteve French <stfrench@microsoft.com>
Sat, 13 Nov 2021 05:29:08 +0000 (23:29 -0600)
We allocate index cookies for each connection from the client.
However, we don't need this index for each channel in case of
multichannel. So making sure that we avoid creating duplicate
cookies by instantiating only for primary channel.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/connect.c

index f80b73f2d0a08c93501dde70f45a8f196503cf2b..82577a7a5bb147101d248c334de5d93220ce4ad3 100644 (file)
@@ -1397,7 +1397,10 @@ cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect)
        spin_unlock(&GlobalMid_Lock);
 
        cifs_crypto_secmech_release(server);
-       cifs_fscache_release_client_cookie(server);
+
+       /* fscache server cookies are based on primary channel only */
+       if (!CIFS_SERVER_IS_CHAN(server))
+               cifs_fscache_release_client_cookie(server);
 
        kfree(server->session_key.response);
        server->session_key.response = NULL;
@@ -1553,7 +1556,9 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,
        list_add(&tcp_ses->tcp_ses_list, &cifs_tcp_ses_list);
        spin_unlock(&cifs_tcp_ses_lock);
 
-       cifs_fscache_get_client_cookie(tcp_ses);
+       /* fscache server cookies are based on primary channel only */
+       if (!CIFS_SERVER_IS_CHAN(tcp_ses))
+               cifs_fscache_get_client_cookie(tcp_ses);
 
        /* queue echo request delayed work */
        queue_delayed_work(cifsiod_wq, &tcp_ses->echo, tcp_ses->echo_interval);