From: Stefan Metzmacher Date: Thu, 15 Apr 2021 07:53:03 +0000 (+0200) Subject: smb2_server: move struct msghdr to smbd_smb2_request_read_state X-Git-Tag: tevent-0.16.0~721 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=948d19b09a75101ac6c050ad83cce401de324f2a;p=thirdparty%2Fsamba.git smb2_server: move struct msghdr to smbd_smb2_request_read_state This makes the code a little bit faster, but 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 --- diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 69023fcc50a..d071dc4c23b 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -463,6 +463,7 @@ struct smbXsrv_connection { bool done; } hdr; struct iovec vector; + struct msghdr msg; bool doing_receivefile; size_t min_recv_size; size_t pktfull; diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 2dbb89d4b58..b0a475ec8c1 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -4888,7 +4888,6 @@ static NTSTATUS smbd_smb2_io_handler(struct smbXsrv_connection *xconn, bool retry; NTSTATUS status; NTTIME now; - struct msghdr msg; if (!NT_STATUS_IS_OK(xconn->transport.status)) { /* @@ -4923,7 +4922,7 @@ again: state->vector.iov_len = NBT_HDR_SIZE; } - msg = (struct msghdr) { + state->msg = (struct msghdr) { .msg_iov = &state->vector, .msg_iovlen = 1, }; @@ -4935,7 +4934,7 @@ again: recvmsg_flags |= MSG_DONTWAIT; #endif - ret = recvmsg(xconn->transport.sock, &msg, recvmsg_flags); + ret = recvmsg(xconn->transport.sock, &state->msg, recvmsg_flags); if (ret == 0) { /* propagate end of file */ status = NT_STATUS_END_OF_FILE;