From 12ce31ce1dbd86dff47a036b36ce6ad506bd7b75 Mon Sep 17 00:00:00 2001 From: Cheyenne Wills Date: Tue, 25 Apr 2023 10:37:01 -0600 Subject: [PATCH] Linux: Do not initialize msghdr's msg_iter/msg_iov Since the initial Linux commit (2.6.12-rc2) the Linux function kernel_recvmsg() handles the initialization of the msghdr members related to the iov (msghdr.msg_iter and for earlier kernels msghdr.msg_iov and msghdr.msg_iovlen). The code in osi_NetReceive for Linux unnecessarily initializes these structure members prior to calling kernel_recvmsg(). Remove the unnecessary code from osi_NetReceive along with the surrounding preprocessor check for STRUCT_MSGHDR_HAS_MSG_ITER. Since this is the only location that uses this define, also remove the associated autoconf test. NOTE: This was discovered while investigating changes needed for Linux 6.4, due to: "iov_iter: add iter_iovec() helper" (de4f5fed3f) which renamed the Linux structure iter_iovec's member iov to __iov. Since the openafs code that was affected by the Linux 6.4 change is being removed as unnecessary, this commit is not Linux 6.4 specific, but effects all versions of Linux. Reviewed-on: https://gerrit.openafs.org/15408 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 5a7630acfd8bfd462b633475a6e195d9dbdfb451) Change-Id: I3a803f76ab84f1e055e91cf4f2be96440f141746 Reviewed-on: https://gerrit.openafs.org/15410 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand --- src/cf/linux-kernel-struct.m4 | 1 - src/rx/LINUX/rx_knet.c | 7 ------- 2 files changed, 8 deletions(-) diff --git a/src/cf/linux-kernel-struct.m4 b/src/cf/linux-kernel-struct.m4 index 3d4b10b13f..8082308e8c 100644 --- a/src/cf/linux-kernel-struct.m4 +++ b/src/cf/linux-kernel-struct.m4 @@ -33,7 +33,6 @@ AC_CHECK_LINUX_STRUCT([key], [payload.value], [key.h]) AC_CHECK_LINUX_STRUCT([key_type], [instantiate_prep], [key-type.h]) AC_CHECK_LINUX_STRUCT([key_type], [match_preparse], [key-type.h]) AC_CHECK_LINUX_STRUCT([key_type], [preparse], [key-type.h]) -AC_CHECK_LINUX_STRUCT([msghdr], [msg_iter], [socket.h]) AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h]) AC_CHECK_LINUX_STRUCT([proc_dir_entry], [owner], [proc_fs.h]) AC_CHECK_LINUX_STRUCT([proc_ops], [proc_compat_ioctl], [proc_fs.h]) diff --git a/src/rx/LINUX/rx_knet.c b/src/rx/LINUX/rx_knet.c index 42444e5bf1..f98c3b10a0 100644 --- a/src/rx/LINUX/rx_knet.c +++ b/src/rx/LINUX/rx_knet.c @@ -202,13 +202,6 @@ osi_NetReceive(osi_socket so, struct sockaddr_in *from, struct iovec *iov, memcpy(tmpvec, iov, iovcnt * sizeof(struct iovec)); msg.msg_name = from; -#if defined(STRUCT_MSGHDR_HAS_MSG_ITER) - msg.msg_iter.iov = tmpvec; - msg.msg_iter.nr_segs = iovcnt; -#else - msg.msg_iov = tmpvec; - msg.msg_iovlen = iovcnt; -#endif msg.msg_control = NULL; msg.msg_controllen = 0; msg.msg_flags = 0;