From 0d7a239ec4d17be3402c4deba0178e1d8f7f21a7 Mon Sep 17 00:00:00 2001 From: visa Date: Mon, 9 May 2022 14:49:55 +0000 Subject: [PATCH] Revert "Replace selwakeup() with KNOTE() in pipe and socket event activation." The commit caused hangs with NFS. Reported by ajacoutot@ and naddy@ --- sys/kern/sys_pipe.c | 9 +++++++-- sys/kern/uipc_socket.c | 4 ++-- sys/kern/uipc_socket2.c | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index daa6b2ad1c4..ada1e55c7ef 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -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); diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index fc485fdad54..caff3c17100 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -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 diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 550779809b0..135bad945e9 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -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); } /* -- 2.20.1