- 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
This commit is contained in:
parent
2c4c54b7a8
commit
c72ae1423b
@ -139,7 +139,6 @@ struct fatcache {
|
||||
struct denode {
|
||||
struct vnode *de_vnode; /* addr of vnode we are part of */
|
||||
u_long de_flag; /* flag bits */
|
||||
struct cdev *de_dev; /* device where direntry lives */
|
||||
u_long de_dirclust; /* cluster of the directory file containing this entry */
|
||||
u_long de_diroffset; /* offset of this entry in the directory cluster */
|
||||
u_long de_fndoffset; /* offset of found dir entry */
|
||||
|
@ -168,7 +168,6 @@ deget(pmp, dirclust, diroffset, depp)
|
||||
ldep->de_dirclust = dirclust;
|
||||
ldep->de_diroffset = diroffset;
|
||||
ldep->de_inode = inode;
|
||||
ldep->de_dev = pmp->pm_devvp->v_rdev;
|
||||
fc_purge(ldep, 0); /* init the fat cache for this denode */
|
||||
|
||||
lockmgr(nvp->v_vnlock, LK_EXCLUSIVE, NULL);
|
||||
|
@ -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);
|
||||
|
@ -180,7 +180,6 @@ msdosfs_create(ap)
|
||||
ndirent.de_LowerCase = 0;
|
||||
ndirent.de_StartCluster = 0;
|
||||
ndirent.de_FileSize = 0;
|
||||
ndirent.de_dev = pdep->de_dev;
|
||||
ndirent.de_pmp = pdep->de_pmp;
|
||||
ndirent.de_flag = DE_ACCESS | DE_CREATE | DE_UPDATE;
|
||||
getnanotime(&ts);
|
||||
@ -302,7 +301,7 @@ msdosfs_getattr(ap)
|
||||
|
||||
getnanotime(&ts);
|
||||
DETIMES(dep, &ts, &ts, &ts);
|
||||
vap->va_fsid = dev2udev(dep->de_dev);
|
||||
vap->va_fsid = dev2udev(pmp->pm_dev);
|
||||
/*
|
||||
* The following computation of the fileid must be the same as that
|
||||
* used in msdosfs_readdir() to compute d_fileno. If not, pwd
|
||||
@ -1410,7 +1409,6 @@ msdosfs_mkdir(ap)
|
||||
ndirent.de_LowerCase = 0;
|
||||
ndirent.de_StartCluster = newcluster;
|
||||
ndirent.de_FileSize = 0;
|
||||
ndirent.de_dev = pdep->de_dev;
|
||||
error = createde(&ndirent, pdep, &dep, cnp);
|
||||
if (error)
|
||||
goto bad;
|
||||
@ -1909,7 +1907,7 @@ msdosfs_print(ap)
|
||||
|
||||
printf("\tstartcluster %lu, dircluster %lu, diroffset %lu, ",
|
||||
dep->de_StartCluster, dep->de_dirclust, dep->de_diroffset);
|
||||
printf("on dev %s\n", devtoname(dep->de_dev));
|
||||
printf("on dev %s\n", devtoname(dep->de_pmp->pm_dev));
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,8 @@ struct msdosfsmount {
|
||||
for files */
|
||||
mode_t pm_dirmask; /* mask to and with file protection bits
|
||||
for directories */
|
||||
struct vnode *pm_devvp; /* vnode for block device mntd */
|
||||
struct vnode *pm_devvp; /* vnode for character device mounted */
|
||||
struct cdev *pm_dev; /* character device mounted */
|
||||
struct bpb50 pm_bpb; /* BIOS parameter blk for this fs */
|
||||
u_long pm_BlkPerSec; /* How many DEV_BSIZE blocks fit inside a physical sector */
|
||||
u_long pm_FATsecs; /* actual number of fat sectors */
|
||||
|
Loading…
x
Reference in New Issue
Block a user