smb2_server: move struct msghdr to smbd_smb2_send_queue
authorStefan Metzmacher <metze@samba.org>
Wed, 30 Sep 2020 21:42:48 +0000 (23:42 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 6 Sep 2023 20:31:04 +0000 (20:31 +0000)
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 <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Sep  6 20:31:04 UTC 2023 on atb-devel-224

source3/smbd/globals.h
source3/smbd/smb2_server.c

index fa10f00a2c10308293cc3d967892bb672fc0d19c..f58e3176f31662dd0d7457c485283a3f27bb1eb6 100644 (file)
@@ -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;
 
index e596e059c1c19481f6121480c114104489416dd1..55b383072e6a3cf1bca466127fed71c978578e3b 100644 (file)
@@ -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;