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
This commit is contained in:
Jason A. Harmening 2023-01-16 15:50:10 -06:00
parent a5d82b55fe
commit d711884e60

View File

@ -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,