Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Apr 2023 01:35:44 GMT
From:      "Jason A. Harmening" <jah@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d711884e60bf - main - Remove unionfs_islocked()
Message-ID:  <202304180135.33I1Zi9l042439@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jah:

URL: https://cgit.FreeBSD.org/src/commit/?id=d711884e60bf55c9572e1882ed1b4645a4aa1ce6

commit d711884e60bf55c9572e1882ed1b4645a4aa1ce6
Author:     Jason A. Harmening <jah@FreeBSD.org>
AuthorDate: 2023-01-16 21:50:10 +0000
Commit:     Jason A. Harmening <jah@FreeBSD.org>
CommitDate: 2023-04-18 01:31:40 +0000

    Remove unionfs_islocked()
    
    The implementation is racy; if the unionfs vnode is not in fact
    locked, vnode private data may be concurrently altered or freed.
    Instead, simply rely upon the standard implementation to query the
    v_vnlock field, which is type-stable and will reflect the correct
    lower/upper vnode configuration for the unionfs node.
    
    Tested by:      pho
    Reviewed by:    kib, markj
    Differential Revision:  https://reviews.freebsd.org/D39272
---
 sys/fs/unionfs/union_vnops.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c
index a0ff5c140e82..0da5ecb61bb2 100644
--- a/sys/fs/unionfs/union_vnops.c
+++ b/sys/fs/unionfs/union_vnops.c
@@ -1852,24 +1852,6 @@ unionfs_print(struct vop_print_args *ap)
 	return (0);
 }
 
-static int
-unionfs_islocked(struct vop_islocked_args *ap)
-{
-	struct unionfs_node *unp;
-
-	KASSERT_UNIONFS_VNODE(ap->a_vp);
-
-	unp = VTOUNIONFS(ap->a_vp);
-	if (unp == NULL)
-		return (vop_stdislocked(ap));
-
-	if (unp->un_uppervp != NULLVP)
-		return (VOP_ISLOCKED(unp->un_uppervp));
-	if (unp->un_lowervp != NULLVP)
-		return (VOP_ISLOCKED(unp->un_lowervp));
-	return (vop_stdislocked(ap));
-}
-
 static int
 unionfs_get_llt_revlock(struct vnode *vp, int flags)
 {
@@ -2790,7 +2772,7 @@ struct vop_vector unionfs_vnodeops = {
 	.vop_getwritemount =	unionfs_getwritemount,
 	.vop_inactive =		unionfs_inactive,
 	.vop_need_inactive =	vop_stdneed_inactive,
-	.vop_islocked =		unionfs_islocked,
+	.vop_islocked =		vop_stdislocked,
 	.vop_ioctl =		unionfs_ioctl,
 	.vop_link =		unionfs_link,
 	.vop_listextattr =	unionfs_listextattr,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304180135.33I1Zi9l042439>