cifs: pick channel for tcon and tdis
authorShyam Prasad N <sprasad@microsoft.com>
Wed, 10 Jan 2024 10:48:36 +0000 (10:48 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 May 2024 14:22:45 +0000 (16:22 +0200)
[ Upstream commit 268b8b5797becb242013fcd63173eb28c007c8ae ]

Today, the tree connect and disconnect requests are
sent on the primary channel only. However, the new
multichannel logic allows the session to remain active
even if one of the channels are alive. So a tree connect
can now be triggered during a reconnect on any of
its channels.

This change changes tcon and tdis calls to pick an
active channel instead of the first one.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/smb/client/smb2pdu.c

index 3f9448b5ada9bd88aa8bf894adf30c49215c698a..95b5b4bdb4b7fd96b56949619586b54114226a4b 100644 (file)
@@ -2019,10 +2019,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
        __le16 *unc_path = NULL;
        int flags = 0;
        unsigned int total_len;
-       struct TCP_Server_Info *server;
-
-       /* always use master channel */
-       server = ses->server;
+       struct TCP_Server_Info *server = cifs_pick_channel(ses);
 
        cifs_dbg(FYI, "TCON\n");
 
@@ -2155,6 +2152,7 @@ SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)
        struct smb2_tree_disconnect_req *req; /* response is trivial */
        int rc = 0;
        struct cifs_ses *ses = tcon->ses;
+       struct TCP_Server_Info *server = cifs_pick_channel(ses);
        int flags = 0;
        unsigned int total_len;
        struct kvec iov[1];
@@ -2177,7 +2175,7 @@ SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)
 
        invalidate_all_cached_dirs(tcon);
 
-       rc = smb2_plain_req_init(SMB2_TREE_DISCONNECT, tcon, ses->server,
+       rc = smb2_plain_req_init(SMB2_TREE_DISCONNECT, tcon, server,
                                 (void **) &req,
                                 &total_len);
        if (rc)
@@ -2195,7 +2193,7 @@ SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)
        rqst.rq_iov = iov;
        rqst.rq_nvec = 1;
 
-       rc = cifs_send_recv(xid, ses, ses->server,
+       rc = cifs_send_recv(xid, ses, server,
                            &rqst, &resp_buf_type, flags, &rsp_iov);
        cifs_small_buf_release(req);
        if (rc) {