From owner-svn-src-all@freebsd.org Mon Apr 27 15:59:08 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B4FE2BD721; Mon, 27 Apr 2020 15:59:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499qG41rqYz4F8K; Mon, 27 Apr 2020 15:59:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3AA94CF7C; Mon, 27 Apr 2020 15:59:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RFx8OA076680; Mon, 27 Apr 2020 15:59:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RFx7i3076678; Mon, 27 Apr 2020 15:59:07 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004271559.03RFx7i3076678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 27 Apr 2020 15:59:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360379 - in head/sys: fs/fifofs kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: fs/fifofs kern X-SVN-Commit-Revision: 360379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 15:59:08 -0000 Author: markj Date: Mon Apr 27 15:59:07 2020 New Revision: 360379 URL: https://svnweb.freebsd.org/changeset/base/360379 Log: Call pipeselwakeup() after toggling PIPE_EOF. This ensures that pipe_poll() and the pipe kqueue filters observe PIPE_EOF and set EV_EOF accordingly. As a result an extra call to knote() after setting PIPE_EOF is unnecessary. Submitted by: Jan Kokemüller MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24528 Modified: head/sys/fs/fifofs/fifo_vnops.c head/sys/kern/sys_pipe.c Modified: head/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- head/sys/fs/fifofs/fifo_vnops.c Mon Apr 27 15:58:55 2020 (r360378) +++ head/sys/fs/fifofs/fifo_vnops.c Mon Apr 27 15:59:07 2020 (r360379) @@ -174,8 +174,10 @@ fifo_open(ap) fip->fi_rgen++; if (fip->fi_readers == 1) { fpipe->pipe_state &= ~PIPE_EOF; - if (fip->fi_writers > 0) + if (fip->fi_writers > 0) { wakeup(&fip->fi_writers); + pipeselwakeup(fpipe); + } } fp->f_pipegen = fpipe->pipe_wgen - fip->fi_writers; } @@ -190,8 +192,10 @@ fifo_open(ap) fip->fi_wgen++; if (fip->fi_writers == 1) { fpipe->pipe_state &= ~PIPE_EOF; - if (fip->fi_readers > 0) + if (fip->fi_readers > 0) { wakeup(&fip->fi_readers); + pipeselwakeup(fpipe); + } } } if ((ap->a_mode & O_NONBLOCK) == 0) { @@ -210,6 +214,7 @@ fifo_open(ap) fpipe->pipe_state |= PIPE_EOF; if (fpipe->pipe_state & PIPE_WANTW) wakeup(fpipe); + pipeselwakeup(fpipe); PIPE_UNLOCK(fpipe); fifo_cleanup(vp); } @@ -238,6 +243,7 @@ fifo_open(ap) if (fpipe->pipe_state & PIPE_WANTR) wakeup(fpipe); fpipe->pipe_wgen++; + pipeselwakeup(fpipe); PIPE_UNLOCK(fpipe); fifo_cleanup(vp); } Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Mon Apr 27 15:58:55 2020 (r360378) +++ head/sys/kern/sys_pipe.c Mon Apr 27 15:59:07 2020 (r360379) @@ -1606,8 +1606,6 @@ pipeclose(struct pipe *cpipe) pipelock(cpipe, 0); pp = cpipe->pipe_pair; - pipeselwakeup(cpipe); - /* * If the other side is blocked, wake it up saying that * we want to close it down. @@ -1621,16 +1619,16 @@ pipeclose(struct pipe *cpipe) pipelock(cpipe, 0); } + pipeselwakeup(cpipe); + /* * Disconnect from peer, if any. */ ppipe = cpipe->pipe_peer; if (ppipe->pipe_present == PIPE_ACTIVE) { - pipeselwakeup(ppipe); - ppipe->pipe_state |= PIPE_EOF; wakeup(ppipe); - KNOTE_LOCKED(&ppipe->pipe_sel.si_note, 0); + pipeselwakeup(ppipe); } /*