Date: Tue, 7 Sep 2021 21:12:37 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 523d58aad179 - main - socket: Remove unneeded SOLISTENING checks Message-ID: <202109072112.187LCbMh023468@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=523d58aad179440bc2440d11b6b4280c18b3dc28 commit 523d58aad179440bc2440d11b6b4280c18b3dc28 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-09-07 18:50:02 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-09-07 21:12:09 +0000 socket: Remove unneeded SOLISTENING checks Now that SOCK_IO_*_LOCK() checks for listening sockets, we can eliminate some racy SOLISTENING() checks. No functional change intended. Reviewed by: tuexen MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31660 --- sys/kern/kern_sendfile.c | 2 -- sys/kern/uipc_socket.c | 21 ++++----------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c index d3043d16f4ec..ba1fc201c2de 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -668,8 +668,6 @@ sendfile_getsock(struct thread *td, int s, struct file **sock_fp, */ if ((*so)->so_proto->pr_protocol == IPPROTO_SCTP) return (EINVAL); - if (SOLISTENING(*so)) - return (ENOTCONN); return (0); } diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index b26d0591cbdd..a502b06ce00e 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1352,10 +1352,6 @@ soconnectat(int fd, struct socket *so, struct sockaddr *nam, struct thread *td) { int error; - /* XXXMJ racy */ - if (SOLISTENING(so)) - return (EOPNOTSUPP); - CURVNET_SET(so->so_vnet); /* * If protocol is connection-based, can only connect once. @@ -1841,14 +1837,8 @@ sosend(struct socket *so, struct sockaddr *addr, struct uio *uio, int error; CURVNET_SET(so->so_vnet); - if (!SOLISTENING(so)) - error = so->so_proto->pr_usrreqs->pru_sosend(so, addr, uio, - top, control, flags, td); - else { - m_freem(top); - m_freem(control); - error = ENOTCONN; - } + error = so->so_proto->pr_usrreqs->pru_sosend(so, addr, uio, + top, control, flags, td); CURVNET_RESTORE(); return (error); } @@ -2843,11 +2833,8 @@ soreceive(struct socket *so, struct sockaddr **psa, struct uio *uio, int error; CURVNET_SET(so->so_vnet); - if (!SOLISTENING(so)) - error = (so->so_proto->pr_usrreqs->pru_soreceive(so, psa, uio, - mp0, controlp, flagsp)); - else - error = ENOTCONN; + error = (so->so_proto->pr_usrreqs->pru_soreceive(so, psa, uio, + mp0, controlp, flagsp)); CURVNET_RESTORE(); return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109072112.187LCbMh023468>