CVSROOT: /cvs Module name: src Changes by: m...@cvs.openbsd.org 2021/05/13 13:43:11
Modified files: sys/kern : uipc_socket.c Log message: Do `so_rcv' cleanup with sblock() held. solock() should be taken before sblock(). soreceive() grabs solock() and then locks `so_rcv'. But later it releases solock() before call uimove(9). So concurrent thread which performs soshutdown() could break sorecive() loop. But `so_rcv' is still locked by sblock() so this soshutdown() thread will sleep in sorflush() at sblock() call. soshutdown() thread doesn't release solock() after sblock() call so it has no matter where to release `so_rcv' - is will be locked until the solock() release. That's why this strange looking code works fine. This sbunlock() movement just after `so_rcv' cleanup affects nothing but makes the code consistent and clean to understand. ok mpi@