From e4eca0334d0f7a946423759e820d6b025fcb4dcb Mon Sep 17 00:00:00 2001 From: visa Date: Mon, 25 Jul 2022 07:28:22 +0000 Subject: [PATCH] Replace selwakeup() with KNOTE() in socket event activation Let's try this again now that the kernel locking issue in nfsrv_rcv() has been fixed. The previous attempt of the conversion triggered hangs on NFS servers. This was probably caused by the removal of the kernel-locked section just prior to the socket upcall. The section had masked a locking error in NFS code. --- sys/kern/uipc_socket.c | 4 ++-- sys/kern/uipc_socket2.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index aa856abc56a..e2eb7ea0892 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.279 2022/07/01 09:56:17 mvs Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.280 2022/07/25 07:28:22 visa Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -2112,7 +2112,7 @@ void sohasoutofband(struct socket *so) { pgsigio(&so->so_sigio, SIGURG, 0); - selwakeup(&so->so_rcv.sb_sel); + KNOTE(&so->so_rcv.sb_sel.si_note, 0); } int diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index e3327e14531..a70dccfe96d 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket2.c,v 1.125 2022/07/01 09:56:17 mvs Exp $ */ +/* $OpenBSD: uipc_socket2.c,v 1.126 2022/07/25 07:28:22 visa Exp $ */ /* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */ /* @@ -501,7 +501,7 @@ sowakeup(struct socket *so, struct sockbuf *sb) } if (sb->sb_flags & SB_ASYNC) pgsigio(&so->so_sigio, SIGIO, 0); - selwakeup(&sb->sb_sel); + KNOTE(&sb->sb_sel.si_note, 0); } /* -- 2.20.1