From owner-dev-commits-src-branches@freebsd.org Tue Aug 3 09:52:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 5C30D63481F; Tue, 3 Aug 2021 09:52:49 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gf9Cj1vLVz3NrF; Tue, 3 Aug 2021 09:52:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18C37112D8; Tue, 3 Aug 2021 09:52:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1739qmcF081382; Tue, 3 Aug 2021 09:52:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1739qmDL081381; Tue, 3 Aug 2021 09:52:48 GMT (envelope-from git) Date: Tue, 3 Aug 2021 09:52:48 GMT Message-Id: <202108030952.1739qmDL081381@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2a56a5c2c21a - stable/13 - fifofs: fifo vnode might be relocked before VOP_OPEN() is called MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2a56a5c2c21a7bf1fc321a60fffbd8d59970633b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:52:49 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2a56a5c2c21a7bf1fc321a60fffbd8d59970633b commit 2a56a5c2c21a7bf1fc321a60fffbd8d59970633b Author: Konstantin Belousov AuthorDate: 2021-07-22 10:27:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-03 09:52:36 +0000 fifofs: fifo vnode might be relocked before VOP_OPEN() is called (cherry picked from commit 10db1896495b744aa5b039dd4ef1973b7a339379) --- sys/fs/fifofs/fifo_vnops.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index d2a51de84fba..861f1b40a744 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -282,9 +282,21 @@ fifo_close(ap) struct pipe *cpipe; vp = ap->a_vp; + ASSERT_VOP_ELOCKED(vp, "fifo_close"); fip = vp->v_fifoinfo; + + /* + * During open, it is possible that the fifo vnode is relocked + * after the vnode is instantiated but before VOP_OPEN() is + * done. For instance, vn_open_vnode() might need to upgrade + * vnode lock, or ffs_vput_pair() needs to unlock vp to sync + * dvp. In this case, reclaim can observe us with v_fifoinfo + * equal to NULL. + */ + if (fip == NULL) + return (0); + cpipe = fip->fi_pipe; - ASSERT_VOP_ELOCKED(vp, "fifo_close"); if (ap->a_fflag & FREAD) { fip->fi_readers--; if (fip->fi_readers == 0) {