From: Stefan Metzmacher Date: Wed, 30 Sep 2020 21:42:48 +0000 (+0200) Subject: smb2_server: move struct msghdr to smbd_smb2_send_queue X-Git-Tag: tevent-0.16.0~713 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fc358275693a1dc44f2d03b43b68d1ee7f1ec14;p=thirdparty%2Fsamba.git smb2_server: move struct msghdr to smbd_smb2_send_queue The main reason is the preparation of io_uring support, as it can't be on the stack for async operations. Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed Sep 6 20:31:04 UTC 2023 on atb-devel-224 --- diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index fa10f00a2c1..f58e3176f31 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -688,6 +688,8 @@ struct smbd_smb2_send_queue { DATA_BLOB *sendfile_header; uint32_t sendfile_body_size; NTSTATUS *sendfile_status; + + struct msghdr msg; struct iovec *vector; int count; diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index e596e059c1c..55b383072e6 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -4780,7 +4780,6 @@ static NTSTATUS smbd_smb2_flush_with_sendmsg(struct smbXsrv_connection *xconn) while (xconn->smb2.send_queue != NULL) { struct smbd_smb2_send_queue *e = xconn->smb2.send_queue; unsigned sendmsg_flags = 0; - struct msghdr msg; if (!NT_STATUS_IS_OK(xconn->transport.status)) { /* @@ -4847,7 +4846,7 @@ static NTSTATUS smbd_smb2_flush_with_sendmsg(struct smbXsrv_connection *xconn) continue; } - msg = (struct msghdr) { + e->msg = (struct msghdr) { .msg_iov = e->vector, .msg_iovlen = e->count, }; @@ -4859,7 +4858,7 @@ static NTSTATUS smbd_smb2_flush_with_sendmsg(struct smbXsrv_connection *xconn) sendmsg_flags |= MSG_DONTWAIT; #endif - ret = sendmsg(xconn->transport.sock, &msg, sendmsg_flags); + ret = sendmsg(xconn->transport.sock, &e->msg, sendmsg_flags); if (ret == 0) { /* propagate end of file */ return NT_STATUS_INTERNAL_ERROR;