[RFC PATCH 28/31] cifs: Convert SMB2 Tree Disconnect request
From: David Howells
Date: Wed Aug 06 2025 - 16:45:31 EST
Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
cc: Steve French <sfrench@xxxxxxxxx>
cc: Paulo Alcantara <pc@xxxxxxxxxxxxx>
cc: Shyam Prasad N <sprasad@xxxxxxxxxxxxx>
cc: Tom Talpey <tom@xxxxxxxxxx>
cc: linux-cifs@xxxxxxxxxxxxxxx
cc: netfs@xxxxxxxxxxxxxxx
cc: linux-fsdevel@xxxxxxxxxxxxxxx
---
fs/smb/client/smb2pdu.c | 31 ++++++++++---------------------
1 file changed, 10 insertions(+), 21 deletions(-)
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index 4300ae311ee2..9357c4953d9f 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -2396,16 +2396,12 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
int
SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)
{
- struct smb_rqst rqst;
struct smb2_tree_disconnect_req *req; /* response is trivial */
- int rc = 0;
+ struct smb_message *smb = NULL;
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];
- struct kvec rsp_iov;
- int resp_buf_type;
+ int rc = 0;
cifs_dbg(FYI, "Tree Disconnect\n");
@@ -2423,33 +2419,26 @@ SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)
invalidate_all_cached_dirs(tcon);
- rc = smb2_plain_req_init(SMB2_TREE_DISCONNECT, tcon, server,
- (void **) &req,
- &total_len);
- if (rc)
- return rc;
+ smb = smb2_create_request(SMB2_TREE_DISCONNECT, server, tcon,
+ sizeof(*req), sizeof(*req), 0,
+ SMB2_REQ_DYNAMIC);
+ if (!smb)
+ return -ENOMEM;
if (smb3_encryption_required(tcon))
flags |= CIFS_TRANSFORM_REQ;
flags |= CIFS_NO_RSP_BUF;
- iov[0].iov_base = (char *)req;
- iov[0].iov_len = total_len;
-
- memset(&rqst, 0, sizeof(struct smb_rqst));
- rqst.rq_iov = iov;
- rqst.rq_nvec = 1;
-
- rc = cifs_send_recv(xid, ses, server,
- &rqst, &resp_buf_type, flags, &rsp_iov);
- cifs_small_buf_release(req);
+ rc = smb_send_recv_messages(xid, ses, server, smb, flags);
+ smb_clear_request(smb);
if (rc) {
cifs_stats_fail_inc(tcon, SMB2_TREE_DISCONNECT);
trace_smb3_tdis_err(xid, tcon->tid, ses->Suid, rc);
}
trace_smb3_tdis_done(xid, tcon->tid, ses->Suid);
+ smb_put_messages(smb);
return rc;
}