diff options
author | jhb <jhb@FreeBSD.org> | 2009-02-27 20:00:15 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-02-27 20:00:15 +0000 |
commit | 90499e3f8eb3ad46cecd13f6219e89c28e330a34 (patch) | |
tree | 4703df2e91319f49ee1838a7c3861e8cdf417d90 /sys/fs/msdosfs/msdosfs_vfsops.c | |
parent | 9456dca639e58d3bd057fb4f73670d88d05212ab (diff) | |
download | FreeBSD-src-90499e3f8eb3ad46cecd13f6219e89c28e330a34.zip FreeBSD-src-90499e3f8eb3ad46cecd13f6219e89c28e330a34.tar.gz |
- Hold a reference on the cdev a filesystem is mounted from in the mount.
- Remove the cdev pointers from the denode and instead use the mountpoint's
reference to call dev2udev() in getattr().
Reviewed by: kib, julian
Diffstat (limited to 'sys/fs/msdosfs/msdosfs_vfsops.c')
-rw-r--r-- | sys/fs/msdosfs/msdosfs_vfsops.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index e8ed48e..2da25a7 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -408,7 +408,7 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) { struct msdosfsmount *pmp; struct buf *bp; - struct cdev *dev = devvp->v_rdev; + struct cdev *dev; union bootsector *bsp; struct byte_bpb33 *b33; struct byte_bpb50 *b50; @@ -419,8 +419,12 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) struct g_consumer *cp; struct bufobj *bo; + bp = NULL; /* This and pmp both used in error_exit. */ + pmp = NULL; ronly = (mp->mnt_flag & MNT_RDONLY) != 0; - /* XXX: use VOP_ACCESS to check FS perms */ + + dev = devvp->v_rdev; + dev_ref(dev); DROP_GIANT(); g_topology_lock(); error = g_vfs_open(devvp, &cp, "msdosfs", ronly ? 0 : 1); @@ -428,11 +432,9 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) PICKUP_GIANT(); VOP_UNLOCK(devvp, 0); if (error) - return (error); + goto error_exit; bo = &devvp->v_bufobj; - bp = NULL; /* This and pmp both used in error_exit. */ - pmp = NULL; /* * Read the boot sector of the filesystem, and then check the @@ -707,6 +709,7 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) * fillinusemap() needs pm_devvp. */ pmp->pm_devvp = devvp; + pmp->pm_dev = dev; /* * Have the inuse map filled in. @@ -763,6 +766,7 @@ error_exit: free(pmp, M_MSDOSFSMNT); mp->mnt_data = NULL; } + dev_rel(dev); return (error); } @@ -827,6 +831,7 @@ msdosfs_unmount(struct mount *mp, int mntflags, struct thread *td) g_topology_unlock(); PICKUP_GIANT(); vrele(pmp->pm_devvp); + dev_rel(pmp->pm_dev); free(pmp->pm_inusemap, M_MSDOSFSFAT); if (pmp->pm_flags & MSDOSFS_LARGEFS) msdosfs_fileno_free(mp); |