CVSROOT:        /cvs
Module name:    src
Changes by:     m...@cvs.openbsd.org    2025/07/25 02:58:44

Modified files:
        sys/kern       : uipc_socket.c 
        sys/sys        : socketvar.h 

Log message:
Do not load `so_qlen' within soreadable().

We already did some movements to call filt_soread() without socket
lock, so adjust soreadable() for that.

In the filt_soread() path  the `so_qlen' is already loaded to local
`qlen' and used as "rv = qlen || soreadable(so)" for return value.
Currently this path of filt_soread() is locked with solock(), so if
`so_qlen' is null the second load within soreadable() only consumes
CPU cycles. But in hypothetically unlocked filt_soread() the
"rv = qlen || soreadable(so)" expression becomes inconsistent.

In the sounsplice() path do the `so_qlen' load and compute `readable'
as "so->so_qlen || soreadable(so)". This load required because after
unsplicing there is nothing stopping `so' from becoming a listening
socket and handling some pending connections before sounsplice()
locks the socket.

ok bluhm

Reply via email to