diff options
author | rodrigc <rodrigc@FreeBSD.org> | 2006-12-09 16:51:09 +0000 |
---|---|---|
committer | rodrigc <rodrigc@FreeBSD.org> | 2006-12-09 16:51:09 +0000 |
commit | b2bd033255027b3b7b76e549b3f541e0fdc1ff3f (patch) | |
tree | 58eda989a53d2204d2c725bc64fc79694e8d015c | |
parent | 951f903c66a5c2c12f43b816d8c08e179d2b3d4f (diff) | |
download | FreeBSD-src-b2bd033255027b3b7b76e549b3f541e0fdc1ff3f.zip FreeBSD-src-b2bd033255027b3b7b76e549b3f541e0fdc1ff3f.tar.gz |
Add locking around calls to unionfs_get_node_status()
in unionfs_ioctl() and unionfs_poll().
Submitted by: daichi, Masanori OZAWA <ozawa@ongs.co.jp>
Prompted by: kris
-rw-r--r-- | sys/fs/unionfs/union_vnops.c | 4 |
1 files changed, 4 insertions, 0 deletions
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); |