From 2f2c6e36696102642cd5fb1e5c4aa72de7bfdf8d Mon Sep 17 00:00:00 2001 From: ssouhlal Date: Fri, 2 Sep 2005 13:52:55 +0000 Subject: ffs_mountfs() needs devvp to be locked, so lock it. Glanced at by: phk Tested by: pjd MFC after: 3 days --- sys/ufs/ffs/ffs_vfsops.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'sys/ufs') diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 19bbb81..111e7a7 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -306,13 +306,13 @@ ffs_mount(struct mount *mp, struct thread *td) * Not an update, or updating the name: look up the name * and verify that it refers to a sensible disk device. */ - NDINIT(&ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec, td); + NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec, td); if ((error = namei(&ndp)) != 0) return (error); NDFREE(&ndp, NDF_ONLY_PNBUF); devvp = ndp.ni_vp; if (!vn_isdisk(devvp, &error)) { - vrele(devvp); + vput(devvp); return (error); } @@ -324,12 +324,10 @@ ffs_mount(struct mount *mp, struct thread *td) accessmode = VREAD; if ((mp->mnt_flag & MNT_RDONLY) == 0) accessmode |= VWRITE; - vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td); if ((error = VOP_ACCESS(devvp, accessmode, td->td_ucred, td))!= 0){ vput(devvp); return (error); } - VOP_UNLOCK(devvp, 0, td); } if (mp->mnt_flag & MNT_UPDATE) { @@ -342,7 +340,7 @@ ffs_mount(struct mount *mp, struct thread *td) if (devvp->v_rdev != ump->um_devvp->v_rdev) error = EINVAL; /* needs translation */ - vrele(devvp); + vput(devvp); if (error) return (error); } else { -- cgit v1.1