From d9b2d9f7a29757aedc9a26cbaee520cd505dca80 Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Thu, 24 Mar 2005 07:36:16 +0000 Subject: [PATCH] - Update vfs_root implementations to match the new prototype. None of these filesystems will support shared locks until they are explicitly modified to do so. Careful review must be done to ensure that this is safe for each individual filesystem. Sponsored by: Isilon Systems, Inc. --- sys/fs/devfs/devfs_vfsops.c | 5 +++-- sys/fs/fdescfs/fdesc_vfsops.c | 3 ++- sys/fs/hpfs/hpfs_vfsops.c | 3 ++- sys/fs/msdosfs/msdosfs_vfsops.c | 6 ++++-- sys/fs/ntfs/ntfs_vfsops.c | 1 + sys/fs/nullfs/null_vfsops.c | 3 ++- sys/fs/nwfs/nwfs_vfsops.c | 4 ++-- sys/fs/portalfs/portal_vfsops.c | 3 ++- sys/fs/pseudofs/pseudofs.c | 2 +- sys/fs/pseudofs/pseudofs.h | 4 ++-- sys/fs/smbfs/smbfs_vfsops.c | 4 ++-- sys/fs/udf/udf_vfsops.c | 2 +- sys/fs/umapfs/umap_vfsops.c | 3 ++- sys/fs/unionfs/union_vfsops.c | 3 ++- sys/fs/unionfs/union_vnops.c | 2 +- 15 files changed, 29 insertions(+), 19 deletions(-) diff --git a/sys/fs/devfs/devfs_vfsops.c b/sys/fs/devfs/devfs_vfsops.c index 4c1c7b8fa40..37212953e5a 100644 --- a/sys/fs/devfs/devfs_vfsops.c +++ b/sys/fs/devfs/devfs_vfsops.c @@ -96,7 +96,7 @@ devfs_mount(struct mount *mp, struct thread *td) fmp->dm_basedir = fmp->dm_rootdir; devfs_rules_newmount(fmp, td); - error = devfs_root(mp, &rvp, td); + error = devfs_root(mp, LK_EXCLUSIVE, &rvp, td); if (error) { lockdestroy(&fmp->dm_lock); FREE(fmp, M_DEVFS); @@ -136,8 +136,9 @@ devfs_unmount(mp, mntflags, td) /* Return locked reference to root. */ static int -devfs_root(mp, vpp, td) +devfs_root(mp, flags, vpp, td) struct mount *mp; + int flags; struct vnode **vpp; struct thread *td; { diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c index e9bb5c75e08..ebd17a4601f 100644 --- a/sys/fs/fdescfs/fdesc_vfsops.c +++ b/sys/fs/fdescfs/fdesc_vfsops.c @@ -126,8 +126,9 @@ fdesc_unmount(mp, mntflags, td) } static int -fdesc_root(mp, vpp, td) +fdesc_root(mp, flags, vpp, td) struct mount *mp; + int flags; struct vnode **vpp; struct thread *td; { diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c index 1757de9f24f..5ce52153547 100644 --- a/sys/fs/hpfs/hpfs_vfsops.c +++ b/sys/fs/hpfs/hpfs_vfsops.c @@ -306,7 +306,7 @@ hpfs_mountfs(devvp, mp, td) goto failed; } - error = hpfs_root(mp, &vp, td); + error = hpfs_root(mp, LK_EXCLUSIVE, &vp, td); if (error) { hpfs_cpdeinit(hpmp); hpfs_bmdeinit(hpmp); @@ -371,6 +371,7 @@ hpfs_unmount( static int hpfs_root( struct mount *mp, + int flags, struct vnode **vpp, struct thread *td ) { diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index d02b9527b4e..288f22d46a1 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -186,7 +186,8 @@ update_mp(mp, td) if (FAT32(pmp)) pmp->pm_flags |= MSDOSFSMNT_LONGNAME; else { - if ((error = msdosfs_root(mp, &rootvp, td)) != 0) + if ((error = + msdosfs_root(mp, LK_EXCLUSIVE, &rootvp, td)) != 0) return error; pmp->pm_flags |= findwin95(VTODE(rootvp)) ? MSDOSFSMNT_LONGNAME @@ -804,8 +805,9 @@ msdosfs_unmount(mp, mntflags, td) } static int -msdosfs_root(mp, vpp, td) +msdosfs_root(mp, flags, vpp, td) struct mount *mp; + int flags; struct vnode **vpp; struct thread *td; { diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index e3ba1a76775..1aae24acac2 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -525,6 +525,7 @@ ntfs_unmount( static int ntfs_root( struct mount *mp, + int flags, struct vnode **vpp, struct thread *td ) { diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index ad6e1e910bd..56b826ccb5c 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -223,8 +223,9 @@ nullfs_unmount(mp, mntflags, td) } static int -nullfs_root(mp, vpp, td) +nullfs_root(mp, flags, vpp, td) struct mount *mp; + int flags; struct vnode **vpp; struct thread *td; { diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c index af8514eb72f..604b6ec10d4 100644 --- a/sys/fs/nwfs/nwfs_vfsops.c +++ b/sys/fs/nwfs/nwfs_vfsops.c @@ -228,7 +228,7 @@ static int nwfs_mount(struct mount *mp, struct thread *td) /* protect against invalid mount points */ nmp->m.mount_point[sizeof(nmp->m.mount_point)-1] = '\0'; vfs_getnewfsid(mp); - error = nwfs_root(mp, &vp, td); + error = nwfs_root(mp, LK_EXCLUSIVE, &vp, td); if (error) goto bad; /* @@ -277,7 +277,7 @@ nwfs_unmount(struct mount *mp, int mntflags, struct thread *td) /* Return locked vnode to root of a filesystem */ static int -nwfs_root(struct mount *mp, struct vnode **vpp, struct thread *td) { +nwfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) { struct vnode *vp; struct nwmount *nmp; struct nwnode *np; diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c index 46c0ab0d52e..a106544e682 100644 --- a/sys/fs/portalfs/portal_vfsops.c +++ b/sys/fs/portalfs/portal_vfsops.c @@ -202,8 +202,9 @@ portal_unmount(mp, mntflags, td) } static int -portal_root(mp, vpp, td) +portal_root(mp, flags, vpp, td) struct mount *mp; + int flags; struct vnode **vpp; struct thread *td; { diff --git a/sys/fs/pseudofs/pseudofs.c b/sys/fs/pseudofs/pseudofs.c index 749c0ebb9aa..1fe0371711e 100644 --- a/sys/fs/pseudofs/pseudofs.c +++ b/sys/fs/pseudofs/pseudofs.c @@ -305,7 +305,7 @@ pfs_unmount(struct mount *mp, int mntflags, struct thread *td) * Return a root vnode */ int -pfs_root(struct mount *mp, struct vnode **vpp, struct thread *td) +pfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) { struct pfs_info *pi; diff --git a/sys/fs/pseudofs/pseudofs.h b/sys/fs/pseudofs/pseudofs.h index a088670ac40..8eaa13735d3 100644 --- a/sys/fs/pseudofs/pseudofs.h +++ b/sys/fs/pseudofs/pseudofs.h @@ -201,8 +201,8 @@ int pfs_mount (struct pfs_info *pi, struct mount *mp, struct thread *td); int pfs_unmount (struct mount *mp, int mntflags, struct thread *td); -int pfs_root (struct mount *mp, struct vnode **vpp, - struct thread *td); +int pfs_root (struct mount *mp, int flags, + struct vnode **vpp, struct thread *td); int pfs_statfs (struct mount *mp, struct statfs *sbp, struct thread *td); int pfs_init (struct pfs_info *pi, struct vfsconf *vfc); diff --git a/sys/fs/smbfs/smbfs_vfsops.c b/sys/fs/smbfs/smbfs_vfsops.c index 8b75ed31442..b774443cbdb 100644 --- a/sys/fs/smbfs/smbfs_vfsops.c +++ b/sys/fs/smbfs/smbfs_vfsops.c @@ -243,7 +243,7 @@ smbfs_mount(struct mount *mp, struct thread *td) } } vfs_getnewfsid(mp); - error = smbfs_root(mp, &vp, td); + error = smbfs_root(mp, LK_EXCLUSIVE, &vp, td); if (error) goto bad; VOP_UNLOCK(vp, 0, td); @@ -316,7 +316,7 @@ smbfs_unmount(struct mount *mp, int mntflags, struct thread *td) * Return locked root vnode of a filesystem */ static int -smbfs_root(struct mount *mp, struct vnode **vpp, struct thread *td) +smbfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) { struct smbmount *smp = VFSTOSMBFS(mp); struct vnode *vp; diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c index b5eb3cd380e..f0db5b2b468 100644 --- a/sys/fs/udf/udf_vfsops.c +++ b/sys/fs/udf/udf_vfsops.c @@ -531,7 +531,7 @@ udf_unmount(struct mount *mp, int mntflags, struct thread *td) } static int -udf_root(struct mount *mp, struct vnode **vpp, struct thread *td) +udf_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) { struct udf_mnt *udfmp; struct vnode *vp; diff --git a/sys/fs/umapfs/umap_vfsops.c b/sys/fs/umapfs/umap_vfsops.c index a516717511a..1d3c74c6539 100644 --- a/sys/fs/umapfs/umap_vfsops.c +++ b/sys/fs/umapfs/umap_vfsops.c @@ -275,8 +275,9 @@ umapfs_unmount(mp, mntflags, td) } static int -umapfs_root(mp, vpp, td) +umapfs_root(mp, flags, vpp, td) struct mount *mp; + int flags; struct vnode **vpp; struct thread *td; { diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index 2b7d2e93cf1..0f8539b378b 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -382,8 +382,9 @@ union_unmount(mp, mntflags, td) } static int -union_root(mp, vpp, td) +union_root(mp, flags, vpp, td) struct mount *mp; + int flags; struct vnode **vpp; struct thread *td; { diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index 7aef07c8549..69699fa7957 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -264,7 +264,7 @@ union_lookup1(udvp, pdvp, vpp, cnp) relock_pdvp = 1; vput(dvp); dvp = NULL; - error = VFS_ROOT(mp, &dvp, td); + error = VFS_ROOT(mp, LK_EXCLUSIVE, &dvp, td); vfs_unbusy(mp, td);