diff options
author | jhb <jhb@FreeBSD.org> | 2008-11-18 23:18:37 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2008-11-18 23:18:37 +0000 |
commit | 14ea2071a81a1af520255018bc6d37f5a6260d46 (patch) | |
tree | c4b9ce21254f1be01b53b5378f4844aeffcbe27e /sys/fs/cd9660 | |
parent | 0c4560d52e12e1c589dc28851e8bb93e3e2d8273 (diff) | |
download | FreeBSD-src-14ea2071a81a1af520255018bc6d37f5a6260d46.zip FreeBSD-src-14ea2071a81a1af520255018bc6d37f5a6260d46.tar.gz |
When looking up the vnode for the device to mount the filesystem on,
ask NDINIT to return a locked vnode instead of letting it drop the
lock and return a referenced vnode and then relock the vnode a few
lines down. This matches the behavior of other filesystem mount routines.
Diffstat (limited to 'sys/fs/cd9660')
-rw-r--r-- | sys/fs/cd9660/cd9660_vfsops.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 919ecf7..adca4c0 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -153,14 +153,14 @@ cd9660_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 block device. */ - NDINIT(&ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec, td); + NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec, td); if ((error = namei(&ndp))) return (error); NDFREE(&ndp, NDF_ONLY_PNBUF); devvp = ndp.ni_vp; if (!vn_isdisk(devvp, &error)) { - vrele(devvp); + vput(devvp); return (error); } @@ -169,7 +169,6 @@ cd9660_mount(struct mount *mp, struct thread *td) * or has superuser abilities */ accmode = VREAD; - vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); error = VOP_ACCESS(devvp, accmode, td->td_ucred, td); if (error) error = priv_check(td, PRIV_VFS_MOUNT_PERM); @@ -177,22 +176,20 @@ cd9660_mount(struct mount *mp, struct thread *td) vput(devvp); return (error); } - VOP_UNLOCK(devvp, 0); if ((mp->mnt_flag & MNT_UPDATE) == 0) { error = iso_mountfs(devvp, mp); + if (error) + vrele(devvp); } else { if (devvp != imp->im_devvp) error = EINVAL; /* needs translation */ - else - vrele(devvp); - } - if (error) { - vrele(devvp); - return error; + vput(devvp); } + if (error) + return (error); vfs_mountedfrom(mp, fspec); - return 0; + return (0); } /* @@ -222,7 +219,6 @@ iso_mountfs(devvp, mp) struct bufobj *bo; char *cs_local, *cs_disk; - vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); DROP_GIANT(); g_topology_lock(); error = g_vfs_open(devvp, &cp, "cd9660", 0); |