From owner-svn-src-all@freebsd.org Tue Aug 27 20:51:18 2019 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 24F8BDF441; Tue, 27 Aug 2019 20:51:18 +0000 (UTC) (envelope-from mjg@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 46J1Hp089zz4KQq; Tue, 27 Aug 2019 20:51:18 +0000 (UTC) (envelope-from mjg@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 DAE89247A7; Tue, 27 Aug 2019 20:51:17 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7RKpHIH026461; Tue, 27 Aug 2019 20:51:17 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RKpHMf026460; Tue, 27 Aug 2019 20:51:17 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908272051.x7RKpHMf026460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 27 Aug 2019 20:51:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351556 - head/sys/fs/unionfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/unionfs X-SVN-Commit-Revision: 351556 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: Tue, 27 Aug 2019 20:51:18 -0000 Author: mjg Date: Tue Aug 27 20:51:17 2019 New Revision: 351556 URL: https://svnweb.freebsd.org/changeset/base/351556 Log: unionfs: stop passing LK_INTERLOCK to VOP_UNLOCK This is part of the preparation to remove flags argument from VOP_UNLOCK. Also has a side effect of fixing stacking on top of nullfs broken by r351472. Reported by: cy Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/unionfs/union_vnops.c Modified: head/sys/fs/unionfs/union_vnops.c ============================================================================== --- head/sys/fs/unionfs/union_vnops.c Tue Aug 27 20:30:56 2019 (r351555) +++ head/sys/fs/unionfs/union_vnops.c Tue Aug 27 20:51:17 2019 (r351556) @@ -1882,12 +1882,9 @@ unionfs_lock(struct vop_lock1_args *ap) if (lvp != NULLVP) { if (uvp != NULLVP && flags & LK_UPGRADE) { /* Share Lock is once released and a deadlock is avoided. */ - VI_LOCK_FLAGS(uvp, MTX_DUPOK); - vholdl(uvp); + vholdnz(uvp); uhold = 1; - VI_UNLOCK(vp); - VOP_UNLOCK(uvp, LK_RELEASE | LK_INTERLOCK); - VI_LOCK(vp); + VOP_UNLOCK(uvp, LK_RELEASE); unp = VTOUNIONFS(vp); if (unp == NULL) { /* vnode is released. */ @@ -1978,7 +1975,6 @@ unionfs_unlock(struct vop_unlock_args *ap) { int error; int flags; - int mtxlkflag; int uhold; struct vnode *vp; struct vnode *lvp; @@ -1988,18 +1984,10 @@ unionfs_unlock(struct vop_unlock_args *ap) KASSERT_UNIONFS_VNODE(ap->a_vp); error = 0; - mtxlkflag = 0; uhold = 0; flags = ap->a_flags | LK_RELEASE; vp = ap->a_vp; - if ((flags & LK_INTERLOCK) != 0) - mtxlkflag = 1; - else if (mtx_owned(VI_MTX(vp)) == 0) { - VI_LOCK(vp); - mtxlkflag = 2; - } - unp = VTOUNIONFS(vp); if (unp == NULL) goto unionfs_unlock_null_vnode; @@ -2007,45 +1995,24 @@ unionfs_unlock(struct vop_unlock_args *ap) uvp = unp->un_uppervp; if (lvp != NULLVP) { - VI_LOCK_FLAGS(lvp, MTX_DUPOK); - flags |= LK_INTERLOCK; - vholdl(lvp); - - VI_UNLOCK(vp); - ap->a_flags &= ~LK_INTERLOCK; - + vholdnz(lvp); error = VOP_UNLOCK(lvp, flags); - - VI_LOCK(vp); } if (error == 0 && uvp != NULLVP) { - VI_LOCK_FLAGS(uvp, MTX_DUPOK); - flags |= LK_INTERLOCK; - vholdl(uvp); + vholdnz(uvp); uhold = 1; - - VI_UNLOCK(vp); - ap->a_flags &= ~LK_INTERLOCK; - error = VOP_UNLOCK(uvp, flags); - - VI_LOCK(vp); } - VI_UNLOCK(vp); if (lvp != NULLVP) vdrop(lvp); if (uhold != 0) vdrop(uvp); - if (mtxlkflag == 0) - VI_LOCK(vp); return error; unionfs_unlock_null_vnode: - if (mtxlkflag == 2) - VI_UNLOCK(vp); return (vop_stdunlock(ap)); }