From b2bd033255027b3b7b76e549b3f541e0fdc1ff3f Mon Sep 17 00:00:00 2001 From: rodrigc Date: Sat, 9 Dec 2006 16:51:09 +0000 Subject: Add locking around calls to unionfs_get_node_status() in unionfs_ioctl() and unionfs_poll(). Submitted by: daichi, Masanori OZAWA Prompted by: kris --- sys/fs/unionfs/union_vnops.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sys/fs/unionfs/union_vnops.c') diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index c06b76d..bb6fa88 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -872,9 +872,11 @@ unionfs_ioctl(struct vop_ioctl_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_ioctl: enter\n"); + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, ap->a_td); unp = VTOUNIONFS(ap->a_vp); unionfs_get_node_status(unp, ap->a_td, &unsp); ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp); + VOP_UNLOCK(ap->a_vp, 0, ap->a_td); if (ovp == NULLVP) return (EBADF); @@ -894,9 +896,11 @@ unionfs_poll(struct vop_poll_args *ap) struct unionfs_node_status *unsp; struct vnode *ovp; + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, ap->a_td); unp = VTOUNIONFS(ap->a_vp); unionfs_get_node_status(unp, ap->a_td, &unsp); ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp); + VOP_UNLOCK(ap->a_vp, 0, ap->a_td); if (ovp == NULLVP) return (EBADF); -- cgit v1.1