From 8f71c77931da0cd478815a9680ed4e209095c39e Mon Sep 17 00:00:00 2001 From: pjd Date: Tue, 17 Apr 2007 21:16:34 +0000 Subject: - Fix a leftover - vfs_mount_alloc() is now exported properly. This fixes stange panics when listing .zfs/snapshot/ directory for me. Reported by: simokawa Reported by: Johan Hendriks - Hide cache_purge() under FREEBSD_NAMECACHE like in other files. - Protect mnt_flag with mount interlock. --- sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c | 9 +++++---- sys/compat/opensolaris/kern/opensolaris_vfs.c | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'sys') diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c b/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c index 074a24b..ee30e3b 100644 --- a/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c +++ b/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c @@ -153,9 +153,6 @@ traverse(vnode_t **cvpp) return (error); } -extern struct mount *vfs_mount_alloc(struct vnode *vp, struct vfsconf *vfsp, - const char *fspath, struct thread *td); - int domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath, char *fspec, int fsflags) @@ -205,10 +202,12 @@ domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath, /* * Set the mount level flags. */ + MNT_ILOCK(mp); if (fsflags & MNT_RDONLY) mp->mnt_flag |= MNT_RDONLY; mp->mnt_flag &=~ MNT_UPDATEMASK; mp->mnt_flag |= fsflags & (MNT_UPDATEMASK | MNT_FORCE | MNT_ROOTFS); + MNT_IUNLOCK(mp); /* * Mount the filesystem. * XXX The final recipients of VFS_MOUNT just overwrite the ndp they @@ -231,7 +230,9 @@ domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath, /* * Put the new filesystem on the mount list after root. */ -// cache_purge(vp); +#ifdef FREEBSD_NAMECACHE + cache_purge(vp); +#endif if (!error) { vnode_t *mvp; diff --git a/sys/compat/opensolaris/kern/opensolaris_vfs.c b/sys/compat/opensolaris/kern/opensolaris_vfs.c index 074a24b..ee30e3b 100644 --- a/sys/compat/opensolaris/kern/opensolaris_vfs.c +++ b/sys/compat/opensolaris/kern/opensolaris_vfs.c @@ -153,9 +153,6 @@ traverse(vnode_t **cvpp) return (error); } -extern struct mount *vfs_mount_alloc(struct vnode *vp, struct vfsconf *vfsp, - const char *fspath, struct thread *td); - int domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath, char *fspec, int fsflags) @@ -205,10 +202,12 @@ domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath, /* * Set the mount level flags. */ + MNT_ILOCK(mp); if (fsflags & MNT_RDONLY) mp->mnt_flag |= MNT_RDONLY; mp->mnt_flag &=~ MNT_UPDATEMASK; mp->mnt_flag |= fsflags & (MNT_UPDATEMASK | MNT_FORCE | MNT_ROOTFS); + MNT_IUNLOCK(mp); /* * Mount the filesystem. * XXX The final recipients of VFS_MOUNT just overwrite the ndp they @@ -231,7 +230,9 @@ domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath, /* * Put the new filesystem on the mount list after root. */ -// cache_purge(vp); +#ifdef FREEBSD_NAMECACHE + cache_purge(vp); +#endif if (!error) { vnode_t *mvp; -- cgit v1.1