Revert "Replace selwakeup() with KNOTE() in pipe and socket event activation."
authorvisa <visa@openbsd.org>
Mon, 9 May 2022 14:49:55 +0000 (14:49 +0000)
committervisa <visa@openbsd.org>
Mon, 9 May 2022 14:49:55 +0000 (14:49 +0000)
The commit caused hangs with NFS.

Reported by ajacoutot@ and naddy@

sys/kern/sys_pipe.c
sys/kern/uipc_socket.c
sys/kern/uipc_socket2.c

index daa6b2a..ada1e55 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: sys_pipe.c,v 1.137 2022/05/06 13:09:41 visa Exp $     */
+/*     $OpenBSD: sys_pipe.c,v 1.138 2022/05/09 14:49:55 visa Exp $     */
 
 /*
  * Copyright (c) 1996 John S. Dyson
@@ -374,7 +374,12 @@ pipeselwakeup(struct pipe *cpipe)
 {
        rw_assert_wrlock(cpipe->pipe_lock);
 
-       KNOTE(&cpipe->pipe_sel.si_note, 0);
+       if (cpipe->pipe_state & PIPE_SEL) {
+               cpipe->pipe_state &= ~PIPE_SEL;
+               selwakeup(&cpipe->pipe_sel);
+       } else {
+               KNOTE(&cpipe->pipe_sel.si_note, 0);
+       }
 
        if (cpipe->pipe_state & PIPE_ASYNC)
                pgsigio(&cpipe->pipe_sigio, SIGIO, 0);
index fc485fd..caff3c1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uipc_socket.c,v 1.276 2022/05/06 13:09:41 visa Exp $  */
+/*     $OpenBSD: uipc_socket.c,v 1.277 2022/05/09 14:49:55 visa Exp $  */
 /*     $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $        */
 
 /*
@@ -2039,7 +2039,7 @@ void
 sohasoutofband(struct socket *so)
 {
        pgsigio(&so->so_sigio, SIGURG, 0);
-       KNOTE(&so->so_rcv.sb_sel.si_note, 0);
+       selwakeup(&so->so_rcv.sb_sel);
 }
 
 int
index 5507798..135bad9 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uipc_socket2.c,v 1.121 2022/05/06 13:09:41 visa Exp $ */
+/*     $OpenBSD: uipc_socket2.c,v 1.122 2022/05/09 14:49:55 visa Exp $ */
 /*     $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $       */
 
 /*
@@ -423,7 +423,7 @@ sowakeup(struct socket *so, struct sockbuf *sb)
        }
        if (sb->sb_flags & SB_ASYNC)
                pgsigio(&so->so_sigio, SIGIO, 0);
-       KNOTE(&sb->sb_sel.si_note, 0);
+       selwakeup(&sb->sb_sel);
 }
 
 /*