From: Matthew Dillon Date: Sat, 11 Dec 2010 08:40:32 +0000 (-0800) Subject: kernel - Make swap, nullfs MPSAFE X-Git-Url: https://gitweb.dragonflybsd.org/~alexh/dragonfly.git/commitdiff_plain/572a7ed95c499105bcdfceb44aee6f2c118a5bf7 kernel - Make swap, nullfs MPSAFE * Mark the swap dummy mount as being MPSAFE so strategy operations do not acquire the mplock. * Mark NULLFS mounts as being MPSAFE so operations do not acquire the mplock. If the underlying VFS is not MPSAFE it will still acquire the mplock. --- diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 47fb214fc5..b47cc614e1 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -143,6 +143,7 @@ vfs_mount_init(void) TAILQ_INIT(&mntvnodescan_list); mount_init(&dummymount); dummymount.mnt_flag |= MNT_RDONLY; + dummymount.mnt_kern_flag |= MNTK_ALL_MPSAFE; } /* diff --git a/sys/kern/vfs_vopops.c b/sys/kern/vfs_vopops.c index 05bb93ce5c..a9944f8422 100644 --- a/sys/kern/vfs_vopops.c +++ b/sys/kern/vfs_vopops.c @@ -830,7 +830,6 @@ vop_strategy(struct vop_ops *ops, struct vnode *vp, struct bio *bio) ap.a_bio = bio; if (vp->v_mount) { - VFS_MPLOCK_FLAG(vp->v_mount, MNTK_SG_MPSAFE); DO_OPS(ops, error, &ap, vop_strategy); VFS_MPUNLOCK(vp->v_mount); diff --git a/sys/vfs/nullfs/null_vfsops.c b/sys/vfs/nullfs/null_vfsops.c index 57901dfc88..c4b261cd54 100644 --- a/sys/vfs/nullfs/null_vfsops.c +++ b/sys/vfs/nullfs/null_vfsops.c @@ -195,9 +195,13 @@ nullfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred) mp->mnt_stat.f_mntfromname, mp->mnt_stat.f_mntfromname); /* - * So unmount won't complain about namecache refs still existing + * Set NCALIASED so unmount won't complain about namecache refs + * still existing. + * + * All NULLFS operations are MPSAFE, though it will be short-lived + * if the underlying filesystem is not. */ - mp->mnt_kern_flag |= MNTK_NCALIASED; + mp->mnt_kern_flag |= MNTK_NCALIASED | MNTK_ALL_MPSAFE; return (0); fail2: nlookup_done(&nd);