Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Oct 2012 17:50:55 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r241896 - in head: . cddl/contrib/opensolaris/lib/libzpool/common/sys share/man/man9 sys/cam/ctl sys/cddl/compat/opensolaris/kern sys/cddl/compat/opensolaris/sys sys/cddl/contrib/openso...
Message-ID:  <201210221750.q9MHot26061585@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Oct 22 17:50:54 2012
New Revision: 241896
URL: http://svn.freebsd.org/changeset/base/241896

Log:
  Remove the support for using non-mpsafe filesystem modules.
  
  In particular, do not lock Giant conditionally when calling into the
  filesystem module, remove the VFS_LOCK_GIANT() and related
  macros. Stop handling buffers belonging to non-mpsafe filesystems.
  
  The VFS_VERSION is bumped to indicate the interface change which does
  not result in the interface signatures changes.
  
  Conducted and reviewed by:	attilio
  Tested by:	pho

Deleted:
  head/share/man/man9/VFS_LOCK_GIANT.9
Modified:
  head/ObsoleteFiles.inc
  head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
  head/share/man/man9/Makefile
  head/share/man/man9/namei.9
  head/sys/cam/ctl/ctl_backend_block.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c
  head/sys/cddl/compat/opensolaris/sys/vnode.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
  head/sys/compat/linprocfs/linprocfs.c
  head/sys/compat/linux/linux_file.c
  head/sys/compat/linux/linux_misc.c
  head/sys/compat/ndis/subr_ndis.c
  head/sys/compat/svr4/svr4_misc.c
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/dev/hwpmc/hwpmc_mod.c
  head/sys/dev/md/md.c
  head/sys/dev/nand/nandsim_swap.c
  head/sys/dev/xen/blkback/blkback.c
  head/sys/fs/nfs/nfs_commonport.c
  head/sys/fs/nfsserver/nfs_nfsdport.c
  head/sys/fs/procfs/procfs_map.c
  head/sys/fs/unionfs/union_subr.c
  head/sys/geom/geom_vfs.c
  head/sys/geom/journal/g_journal.c
  head/sys/i386/ibcs2/ibcs2_misc.c
  head/sys/kern/imgact_elf.c
  head/sys/kern/kern_acct.c
  head/sys/kern/kern_alq.c
  head/sys/kern/kern_ctf.c
  head/sys/kern/kern_descrip.c
  head/sys/kern/kern_exec.c
  head/sys/kern/kern_exit.c
  head/sys/kern/kern_gzio.c
  head/sys/kern/kern_jail.c
  head/sys/kern/kern_ktrace.c
  head/sys/kern/kern_linker.c
  head/sys/kern/kern_proc.c
  head/sys/kern/kern_sig.c
  head/sys/kern/link_elf.c
  head/sys/kern/link_elf_obj.c
  head/sys/kern/sys_process.c
  head/sys/kern/uipc_syscalls.c
  head/sys/kern/uipc_usrreq.c
  head/sys/kern/vfs_acl.c
  head/sys/kern/vfs_aio.c
  head/sys/kern/vfs_bio.c
  head/sys/kern/vfs_cache.c
  head/sys/kern/vfs_default.c
  head/sys/kern/vfs_extattr.c
  head/sys/kern/vfs_init.c
  head/sys/kern/vfs_lookup.c
  head/sys/kern/vfs_mount.c
  head/sys/kern/vfs_mountroot.c
  head/sys/kern/vfs_subr.c
  head/sys/kern/vfs_syscalls.c
  head/sys/kern/vfs_vnops.c
  head/sys/nfsserver/nfs.h
  head/sys/nfsserver/nfs_serv.c
  head/sys/nfsserver/nfs_srvsubs.c
  head/sys/nlm/nlm_prot_impl.c
  head/sys/security/audit/audit_arg.c
  head/sys/security/audit/audit_syscalls.c
  head/sys/security/audit/audit_worker.c
  head/sys/security/mac/mac_process.c
  head/sys/security/mac/mac_syscalls.c
  head/sys/sys/buf.h
  head/sys/sys/bufobj.h
  head/sys/sys/mount.h
  head/sys/sys/namei.h
  head/sys/ufs/ffs/ffs_alloc.c
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ufs/ufs_quota.c
  head/sys/vm/vm_fault.c
  head/sys/vm/vm_mmap.c
  head/sys/vm/vm_object.c
  head/sys/vm/vm_pageout.c
  head/sys/vm/vnode_pager.c

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/ObsoleteFiles.inc	Mon Oct 22 17:50:54 2012	(r241896)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20121022: VFS_LOCK_GIANT elimination
+OLD_FILES+=usr/share/man/man9/VFS_LOCK_GIANT.9.gz
 # 20121004: remove incomplete unwind.h
 OLD_FILES+=usr/include/clang/3.2/unwind.h
 # 20120908: pf cleanup

Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h	Mon Oct 22 17:50:54 2012	(r241896)
@@ -430,14 +430,6 @@ extern int fop_getattr(vnode_t *vp, vatt
 
 #define	vn_lock(vp, type)
 #define	VOP_UNLOCK(vp, type)
-#ifdef VFS_LOCK_GIANT
-#undef VFS_LOCK_GIANT
-#endif
-#define	VFS_LOCK_GIANT(mp)	0
-#ifdef VFS_UNLOCK_GIANT
-#undef VFS_UNLOCK_GIANT
-#endif
-#define	VFS_UNLOCK_GIANT(vfslocked)
 
 extern int vn_open(char *path, int x1, int oflags, int mode, vnode_t **vpp,
     int x2, int x3);

Modified: head/share/man/man9/Makefile
==============================================================================
--- head/share/man/man9/Makefile	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/share/man/man9/Makefile	Mon Oct 22 17:50:54 2012	(r241896)
@@ -280,7 +280,6 @@ MAN=	accept_filter.9 \
 	vfs_getnewfsid.9 \
 	vfs_getopt.9 \
 	vfs_getvfs.9 \
-	VFS_LOCK_GIANT.9 \
 	VFS_MOUNT.9 \
 	vfs_mount.9 \
 	vfs_mountedfrom.9 \
@@ -1413,7 +1412,6 @@ MLINKS+=vfs_getopt.9 vfs_copyopt.9 \
 	vfs_getopt.9 vfs_setopt.9 \
 	vfs_getopt.9 vfs_setopt_part.9 \
 	vfs_getopt.9 vfs_setopts.9
-MLINKS+=VFS_LOCK_GIANT.9 VFS_UNLOCK_GIANT.9
 MLINKS+=vhold.9 vdrop.9 \
 	vhold.9 vdropl.9 \
 	vhold.9 vholdl.9

Modified: head/share/man/man9/namei.9
==============================================================================
--- head/share/man/man9/namei.9	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/share/man/man9/namei.9	Mon Oct 22 17:50:54 2012	(r241896)
@@ -168,19 +168,6 @@ This flag allows the
 function to return the parent (directory) vnode in an unlocked state.
 The parent vnode must be released separately by using
 .Xr vrele 9 .
-.It Dv MPSAFE
-With this flag set,
-.Fn namei
-will conditionally acquire
-.Va Giant
-if it is required by a traversed file system.
-MPSAFE callers should pass the results of
-.Fn NDHASGIANT
-to
-.Xr VFS_UNLOCK_GIANT
-in order to conditionally release
-.Va Giant
-if necessary.
 .It Dv NOCACHE
 Avoid
 .Fn namei
@@ -354,7 +341,6 @@ An attempt is made to modify a file or d
 .Xr uio 9 ,
 .Xr uma 9 ,
 .Xr VFS 9 ,
-.Xr VFS_UNLOCK_GIANT 9 ,
 .Xr vnode 9 ,
 .Xr vput 9 ,
 .Xr vref 9

Modified: head/sys/cam/ctl/ctl_backend_block.c
==============================================================================
--- head/sys/cam/ctl/ctl_backend_block.c	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/cam/ctl/ctl_backend_block.c	Mon Oct 22 17:50:54 2012	(r241896)
@@ -594,14 +594,12 @@ ctl_be_block_flush_file(struct ctl_be_bl
 {
 	union ctl_io *io;
 	struct mount *mountpoint;
-	int vfs_is_locked, error, lock_flags;
+	int error, lock_flags;
 
 	DPRINTF("entered\n");
 
 	io = beio->io;
 
-	vfs_is_locked = VFS_LOCK_GIANT(be_lun->vn->v_mount);
-
        	(void) vn_start_write(be_lun->vn, &mountpoint, V_WAIT);
 
 	if (MNT_SHARED_WRITES(mountpoint)
@@ -621,8 +619,6 @@ ctl_be_block_flush_file(struct ctl_be_bl
 
 	vn_finished_write(mountpoint);
 
-	VFS_UNLOCK_GIANT(vfs_is_locked);
-
 	if (error == 0)
 		ctl_set_success(&io->scsiio);
 	else {
@@ -648,7 +644,7 @@ ctl_be_block_dispatch_file(struct ctl_be
 	union ctl_io *io;
 	struct uio xuio;
 	struct iovec *xiovec;
-	int vfs_is_locked, flags;
+	int flags;
 	int error, i;
 
 	DPRINTF("entered\n");
@@ -681,7 +677,6 @@ ctl_be_block_dispatch_file(struct ctl_be
 		xiovec->iov_len = beio->sg_segs[i].len;
 	}
 
-	vfs_is_locked = VFS_LOCK_GIANT(be_lun->vn->v_mount);
 	if (beio->bio_cmd == BIO_READ) {
 		vn_lock(be_lun->vn, LK_SHARED | LK_RETRY);
 
@@ -754,7 +749,6 @@ ctl_be_block_dispatch_file(struct ctl_be
 
 		vn_finished_write(mountpoint);
         }
-        VFS_UNLOCK_GIANT(vfs_is_locked);
 
 	/*
 	 * If we got an error, set the sense data to "MEDIUM ERROR" and
@@ -1478,7 +1472,6 @@ ctl_be_block_close(struct ctl_be_block_l
 	DROP_GIANT();
 	if (be_lun->vn) {
 		int flags = FREAD | FWRITE;
-		int vfs_is_locked = 0;
 
 		switch (be_lun->dev_type) {
 		case CTL_BE_BLOCK_DEV:
@@ -1490,7 +1483,6 @@ ctl_be_block_close(struct ctl_be_block_l
 			}
 			break;
 		case CTL_BE_BLOCK_FILE:
-			vfs_is_locked = VFS_LOCK_GIANT(be_lun->vn->v_mount);
 			break;
 		case CTL_BE_BLOCK_NONE:
 		default:
@@ -1505,7 +1497,6 @@ ctl_be_block_close(struct ctl_be_block_l
 		case CTL_BE_BLOCK_DEV:
 			break;
 		case CTL_BE_BLOCK_FILE:
-			VFS_UNLOCK_GIANT(vfs_is_locked);
 			if (be_lun->backend.file.cred != NULL) {
 				crfree(be_lun->backend.file.cred);
 				be_lun->backend.file.cred = NULL;
@@ -1529,7 +1520,6 @@ ctl_be_block_open(struct ctl_be_block_so
 	struct nameidata nd;
 	int		 flags;
 	int		 error;
-	int		 vfs_is_locked;
 
 	/*
 	 * XXX KDM allow a read-only option?
@@ -1587,8 +1577,6 @@ ctl_be_block_open(struct ctl_be_block_so
 		return (error);
 	}
 
-	vfs_is_locked = NDHASGIANT(&nd);
-
 	NDFREE(&nd, NDF_ONLY_PNBUF);
 		
 	be_lun->vn = nd.ni_vp;
@@ -1604,7 +1592,6 @@ ctl_be_block_open(struct ctl_be_block_so
 			 "%s is not a disk or file", be_lun->dev_path);
 	}
 	VOP_UNLOCK(be_lun->vn, 0);
-	VFS_UNLOCK_GIANT(vfs_is_locked);
 
 	if (error != 0) {
 		ctl_be_block_close(be_lun);
@@ -2090,7 +2077,7 @@ ctl_be_block_modify(struct ctl_be_block_
 {
 	struct ctl_lun_modify_params *params;
 	struct ctl_be_block_lun *be_lun;
-	int vfs_is_locked, error;
+	int error;
 
 	params = &req->reqdata.modify;
 
@@ -2120,7 +2107,6 @@ ctl_be_block_modify(struct ctl_be_block_
 		}
 	}
 
-	vfs_is_locked = VFS_LOCK_GIANT(be_lun->vn->v_mount);
 	vn_lock(be_lun->vn, LK_SHARED | LK_RETRY);
 
 	if (be_lun->vn->v_type == VREG)
@@ -2129,7 +2115,6 @@ ctl_be_block_modify(struct ctl_be_block_
 		error = ctl_be_block_modify_dev(be_lun, req);
 
 	VOP_UNLOCK(be_lun->vn, 0);
-	VFS_UNLOCK_GIANT(vfs_is_locked);
 
 	if (error != 0)
 		goto bailout_error;

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c
==============================================================================
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c	Mon Oct 22 17:50:54 2012	(r241896)
@@ -69,7 +69,7 @@ kobj_open_file_vnode(const char *file)
 	struct thread *td = curthread;
 	struct filedesc *fd;
 	struct nameidata nd;
-	int error, flags, vfslocked;
+	int error, flags;
 
 	fd = td->td_proc->p_fd;
 	FILEDESC_XLOCK(fd);
@@ -84,15 +84,13 @@ kobj_open_file_vnode(const char *file)
 	FILEDESC_XUNLOCK(fd);
 
 	flags = FREAD | O_NOFOLLOW;
-	NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td);
+	NDINIT(&nd, LOOKUP, 0, UIO_SYSSPACE, file, td);
 	error = vn_open_cred(&nd, &flags, 0, 0, curthread->td_ucred, NULL);
 	if (error != 0)
 		return (NULL);
-	vfslocked = NDHASGIANT(&nd);
 	NDFREE(&nd, NDF_ONLY_PNBUF);
 	/* We just unlock so we hold a reference. */
 	VOP_UNLOCK(nd.ni_vp, 0);
-	VFS_UNLOCK_GIANT(vfslocked);
 	return (nd.ni_vp);
 }
 
@@ -130,15 +128,13 @@ kobj_get_filesize_vnode(struct _buf *fil
 {
 	struct vnode *vp = file->ptr;
 	struct vattr va;
-	int error, vfslocked;
+	int error;
 
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	vn_lock(vp, LK_SHARED | LK_RETRY);
 	error = VOP_GETATTR(vp, &va, curthread->td_ucred);
 	VOP_UNLOCK(vp, 0);
 	if (error == 0)
 		*size = (uint64_t)va.va_size;
-	VFS_UNLOCK_GIANT(vfslocked);
 	return (error);
 }
 
@@ -171,7 +167,7 @@ kobj_read_file_vnode(struct _buf *file, 
 	struct thread *td = curthread;
 	struct uio auio;
 	struct iovec aiov;
-	int error, vfslocked;
+	int error;
 
 	bzero(&aiov, sizeof(aiov));
 	bzero(&auio, sizeof(auio));
@@ -187,11 +183,9 @@ kobj_read_file_vnode(struct _buf *file, 
 	auio.uio_resid = size;
 	auio.uio_td = td;
 
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	vn_lock(vp, LK_SHARED | LK_RETRY);
 	error = VOP_READ(vp, &auio, IO_UNIT | IO_SYNC, td->td_ucred);
 	VOP_UNLOCK(vp, 0);
-	VFS_UNLOCK_GIANT(vfslocked);
 	return (error != 0 ? -1 : size - auio.uio_resid);
 }
 
@@ -221,14 +215,7 @@ void
 kobj_close_file(struct _buf *file)
 {
 
-	if (file->mounted) {
-		struct vnode *vp = file->ptr;
-		struct thread *td = curthread;
-		int vfslocked;
-
-		vfslocked = VFS_LOCK_GIANT(vp->v_mount);
-		vn_close(vp, FREAD, td->td_ucred, td);
-		VFS_UNLOCK_GIANT(vfslocked);
-	}
+	if (file->mounted)
+		vn_close(file->ptr, FREAD, curthread->td_ucred, curthread);
 	kmem_free(file, sizeof(*file));
 }

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c
==============================================================================
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c	Mon Oct 22 17:50:54 2012	(r241896)
@@ -54,7 +54,7 @@ lookupnameat(char *dirname, enum uio_seg
 	vref(startvp);
 	ltype = VOP_ISLOCKED(startvp);
 	VOP_UNLOCK(startvp, 0);
-	NDINIT_ATVP(&nd, LOOKUP, LOCKLEAF | MPSAFE | follow, seg, dirname,
+	NDINIT_ATVP(&nd, LOOKUP, LOCKLEAF | follow, seg, dirname,
 	    startvp, curthread);
 	error = namei(&nd);
 	*compvpp = nd.ni_vp;

Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h
==============================================================================
--- head/sys/cddl/compat/opensolaris/sys/vnode.h	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/cddl/compat/opensolaris/sys/vnode.h	Mon Oct 22 17:50:54 2012	(r241896)
@@ -193,7 +193,7 @@ vn_openat(char *pnamep, enum uio_seg seg
 
 	if (startvp != NULL)
 		vref(startvp);
-	NDINIT_ATVP(&nd, operation, MPSAFE, UIO_SYSSPACE, pnamep, startvp, td);
+	NDINIT_ATVP(&nd, operation, 0, UIO_SYSSPACE, pnamep, startvp, td);
 	filemode |= O_NOFOLLOW;
 	error = vn_open_cred(&nd, &filemode, createmode, 0, td->td_ucred, NULL);
 	NDFREE(&nd, NDF_ONLY_PNBUF);
@@ -223,13 +223,12 @@ zfs_vn_rdwr(enum uio_rw rw, vnode_t *vp,
     ssize_t *residp)
 {
 	struct thread *td = curthread;
-	int error, vfslocked;
+	int error;
 	ssize_t resid;
 
 	ASSERT(ioflag == 0);
 	ASSERT(ulimit == RLIM64_INFINITY);
 
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	if (rw == UIO_WRITE) {
 		ioflag = IO_SYNC;
 	} else {
@@ -237,7 +236,6 @@ zfs_vn_rdwr(enum uio_rw rw, vnode_t *vp,
 	}
 	error = vn_rdwr(rw, vp, base, len, offset, seg, ioflag, cr, NOCRED,
 	    &resid, td);
-	VFS_UNLOCK_GIANT(vfslocked);
 	if (residp != NULL)
 		*residp = (ssize_t)resid;
 	return (error);
@@ -249,11 +247,10 @@ static __inline int
 zfs_vop_fsync(vnode_t *vp, int flag, cred_t *cr)
 {
 	struct mount *mp;
-	int error, vfslocked;
+	int error;
 
 	ASSERT(flag == FSYNC);
 
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
 		goto drop;
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
@@ -261,7 +258,6 @@ zfs_vop_fsync(vnode_t *vp, int flag, cre
 	VOP_UNLOCK(vp, 0);
 	vn_finished_write(mp);
 drop:
-	VFS_UNLOCK_GIANT(vfslocked);
 	return (error);
 }
 #define	VOP_FSYNC(vp, flag, cr, ct)	zfs_vop_fsync((vp), (flag), (cr))
@@ -269,14 +265,12 @@ drop:
 static __inline int
 zfs_vop_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr)
 {
-	int error, vfslocked;
+	int error;
 
 	ASSERT(count == 1);
 	ASSERT(offset == 0);
 
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	error = vn_close(vp, flag, cr, curthread);
-	VFS_UNLOCK_GIANT(vfslocked);
 	return (error);
 }
 #define	VOP_CLOSE(vp, oflags, count, offset, cr, ct)			\

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c	Mon Oct 22 17:50:54 2012	(r241896)
@@ -54,7 +54,7 @@ vdev_file_open(vdev_t *vd, uint64_t *psi
 	vdev_file_t *vf;
 	vnode_t *vp;
 	vattr_t vattr;
-	int error, vfslocked;
+	int error;
 
 	/*
 	 * We must have a pathname, and it must be absolute.
@@ -114,11 +114,9 @@ skip_open:
 	 * Determine the physical size of the file.
 	 */
 	vattr.va_mask = AT_SIZE;
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	vn_lock(vp, LK_SHARED | LK_RETRY);
 	error = VOP_GETATTR(vp, &vattr, kcred);
 	VOP_UNLOCK(vp, 0);
-	VFS_UNLOCK_GIANT(vfslocked);
 	if (error) {
 		(void) VOP_CLOSE(vp, spa_mode(vd->vdev_spa), 1, 0, kcred, NULL);
 		vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Mon Oct 22 17:50:54 2012	(r241896)
@@ -1092,14 +1092,12 @@ zfs_get_done(zgd_t *zgd, int error)
 {
 	znode_t *zp = zgd->zgd_private;
 	objset_t *os = zp->z_zfsvfs->z_os;
-	int vfslocked;
 
 	if (zgd->zgd_db)
 		dmu_buf_rele(zgd->zgd_db, zgd);
 
 	zfs_range_unlock(zgd->zgd_rl);
 
-	vfslocked = VFS_LOCK_GIANT(zp->z_zfsvfs->z_vfs);
 	/*
 	 * Release the vnode asynchronously as we currently have the
 	 * txg stopped from syncing.
@@ -1110,7 +1108,6 @@ zfs_get_done(zgd_t *zgd, int error)
 		zil_add_block(zgd->zgd_zilog, zgd->zgd_bp);
 
 	kmem_free(zgd, sizeof (zgd_t));
-	VFS_UNLOCK_GIANT(vfslocked);
 }
 
 #ifdef DEBUG
@@ -6337,7 +6334,7 @@ vop_getextattr {
 	}
 
 	flags = FREAD;
-	NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, attrname,
+	NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname,
 	    xvp, td);
 	error = vn_open_cred(&nd, &flags, 0, 0, ap->a_cred, NULL);
 	vp = nd.ni_vp;
@@ -6405,7 +6402,7 @@ vop_deleteextattr {
 		return (error);
 	}
 
-	NDINIT_ATVP(&nd, DELETE, NOFOLLOW | LOCKPARENT | LOCKLEAF | MPSAFE,
+	NDINIT_ATVP(&nd, DELETE, NOFOLLOW | LOCKPARENT | LOCKLEAF,
 	    UIO_SYSSPACE, attrname, xvp, td);
 	error = namei(&nd);
 	vp = nd.ni_vp;
@@ -6472,7 +6469,7 @@ vop_setextattr {
 	}
 
 	flags = FFLAGS(O_WRONLY | O_CREAT);
-	NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, attrname,
+	NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname,
 	    xvp, td);
 	error = vn_open_cred(&nd, &flags, 0600, 0, ap->a_cred, NULL);
 	vp = nd.ni_vp;
@@ -6553,7 +6550,7 @@ vop_listextattr {
 		return (error);
 	}
 
-	NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | LOCKSHARED | MPSAFE,
+	NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | LOCKSHARED,
 	    UIO_SYSSPACE, ".", xvp, td);
 	error = namei(&nd);
 	vp = nd.ni_vp;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c	Mon Oct 22 17:50:54 2012	(r241896)
@@ -1404,7 +1404,6 @@ zfs_zinactive(znode_t *zp)
 	vnode_t	*vp = ZTOV(zp);
 	zfsvfs_t *zfsvfs = zp->z_zfsvfs;
 	uint64_t z_id = zp->z_id;
-	int vfslocked;
 
 	ASSERT(zp->z_sa_hdl);
 
@@ -1437,9 +1436,7 @@ zfs_zinactive(znode_t *zp)
 		ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id);
 		ASSERT(vp->v_count == 0);
 		vrecycle(vp);
-		vfslocked = VFS_LOCK_GIANT(zfsvfs->z_vfs);
 		zfs_rmnode(zp);
-		VFS_UNLOCK_GIANT(vfslocked);
 		return;
 	}
 

Modified: head/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- head/sys/compat/linprocfs/linprocfs.c	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/compat/linprocfs/linprocfs.c	Mon Oct 22 17:50:54 2012	(r241896)
@@ -335,7 +335,7 @@ linprocfs_domtab(PFS_FILL_ARGS)
 	int error;
 
 	/* resolve symlinks etc. in the emulation tree prefix */
-	NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, linux_emul_path, td);
+	NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path, td);
 	flep = NULL;
 	error = namei(&nd);
 	lep = linux_emul_path;
@@ -343,7 +343,6 @@ linprocfs_domtab(PFS_FILL_ARGS)
 		if (vn_fullpath(td, nd.ni_vp, &dlep, &flep) == 0)
 			lep = dlep;
 		vrele(nd.ni_vp);
-		VFS_UNLOCK_GIANT(NDHASGIANT(&nd));
 	}
 	lep_len = strlen(lep);
 
@@ -414,7 +413,7 @@ linprocfs_dopartitions(PFS_FILL_ARGS)
 	int major, minor;
 
 	/* resolve symlinks etc. in the emulation tree prefix */
-	NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, linux_emul_path, td);
+	NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path, td);
 	flep = NULL;
 	error = namei(&nd);
 	lep = linux_emul_path;
@@ -422,7 +421,6 @@ linprocfs_dopartitions(PFS_FILL_ARGS)
 		if (vn_fullpath(td, nd.ni_vp, &dlep, &flep) == 0)
 			lep = dlep;
 		vrele(nd.ni_vp);
-		VFS_UNLOCK_GIANT(NDHASGIANT(&nd));
 	}
 	lep_len = strlen(lep);
 
@@ -1012,7 +1010,6 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 	int error;
 	struct vnode *vp;
 	struct vattr vat;
-	int locked;
 
 	PROC_LOCK(p);
 	error = p_candebug(td, p);
@@ -1065,12 +1062,10 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 			VM_OBJECT_UNLOCK(obj);
 			if (vp) {
 				vn_fullpath(td, vp, &name, &freename);
-				locked = VFS_LOCK_GIANT(vp->v_mount);
 				vn_lock(vp, LK_SHARED | LK_RETRY);
 				VOP_GETATTR(vp, &vat, td->td_ucred);
 				ino = vat.va_fileid;
 				vput(vp);
-				VFS_UNLOCK_GIANT(locked);
 			}
 		} else {
 			flags = 0;

Modified: head/sys/compat/linux/linux_file.c
==============================================================================
--- head/sys/compat/linux/linux_file.c	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/compat/linux/linux_file.c	Mon Oct 22 17:50:54 2012	(r241896)
@@ -337,7 +337,7 @@ getdents_common(struct thread *td, struc
 	struct l_dirent64 *linux_dirent64;
 	int buflen, error, eofflag, nbytes, justone;
 	u_long *cookies = NULL, *cookiep;
-	int ncookies, vfslocked;
+	int ncookies;
 
 	nbytes = args->count;
 	if (nbytes == 1) {
@@ -359,9 +359,7 @@ getdents_common(struct thread *td, struc
 
 	off = foffset_lock(fp, 0);
 	vp = fp->f_vnode;
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	if (vp->v_type != VDIR) {
-		VFS_UNLOCK_GIANT(vfslocked);
 		foffset_unlock(fp, off, 0);
 		fdrop(fp, td);
 		return (EINVAL);
@@ -521,7 +519,6 @@ out:
 		free(cookies, M_TEMP);
 
 	VOP_UNLOCK(vp, 0);
-	VFS_UNLOCK_GIANT(vfslocked);
 	foffset_unlock(fp, off, 0);
 	fdrop(fp, td);
 	free(buf, M_TEMP);

Modified: head/sys/compat/linux/linux_misc.c
==============================================================================
--- head/sys/compat/linux/linux_misc.c	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/compat/linux/linux_misc.c	Mon Oct 22 17:50:54 2012	(r241896)
@@ -247,7 +247,7 @@ linux_uselib(struct thread *td, struct l
 	char *library;
 	ssize_t aresid;
 	int error;
-	int locked, vfslocked;
+	int locked;
 
 	LCONVPATHEXIST(td, args->library, &library);
 
@@ -257,11 +257,10 @@ linux_uselib(struct thread *td, struct l
 #endif
 
 	a_out = NULL;
-	vfslocked = 0;
 	locked = 0;
 	vp = NULL;
 
-	NDINIT(&ni, LOOKUP, ISOPEN | FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1,
+	NDINIT(&ni, LOOKUP, ISOPEN | FOLLOW | LOCKLEAF | AUDITVNODE1,
 	    UIO_SYSSPACE, library, td);
 	error = namei(&ni);
 	LFREEPATH(library);
@@ -269,7 +268,6 @@ linux_uselib(struct thread *td, struct l
 		goto cleanup;
 
 	vp = ni.ni_vp;
-	vfslocked = NDHASGIANT(&ni);
 	NDFREE(&ni, NDF_ONLY_PNBUF);
 
 	/*
@@ -393,7 +391,6 @@ linux_uselib(struct thread *td, struct l
 	 */
 	locked = 0;
 	VOP_UNLOCK(vp, 0);
-	VFS_UNLOCK_GIANT(vfslocked);
 
 	/*
 	 * Check if file_offset page aligned. Currently we cannot handle
@@ -463,10 +460,8 @@ linux_uselib(struct thread *td, struct l
 
 cleanup:
 	/* Unlock vnode if needed */
-	if (locked) {
+	if (locked)
 		VOP_UNLOCK(vp, 0);
-		VFS_UNLOCK_GIANT(vfslocked);
-	}
 
 	/* Release the temporary mapping. */
 	if (a_out)

Modified: head/sys/compat/ndis/subr_ndis.c
==============================================================================
--- head/sys/compat/ndis/subr_ndis.c	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/compat/ndis/subr_ndis.c	Mon Oct 22 17:50:54 2012	(r241896)
@@ -2741,7 +2741,7 @@ NdisOpenFile(status, filehandle, filelen
 	char			*afilename = NULL;
 	struct thread		*td = curthread;
 	struct nameidata	nd;
-	int			flags, error, vfslocked;
+	int			flags, error;
 	struct vattr		vat;
 	struct vattr		*vap = &vat;
 	ndis_fh			*fh;
@@ -2821,7 +2821,7 @@ NdisOpenFile(status, filehandle, filelen
 	if (td->td_proc->p_fd->fd_cdir == NULL)
 		td->td_proc->p_fd->fd_cdir = rootvnode;
 
-	NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, path, td);
+	NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, td);
 
 	flags = FREAD;
 	error = vn_open(&nd, &flags, 0, NULL);
@@ -2833,7 +2833,6 @@ NdisOpenFile(status, filehandle, filelen
 		free(afilename, M_DEVBUF);
 		return;
 	}
-	vfslocked = NDHASGIANT(&nd);
 
 	ExFreePool(path);
 
@@ -2842,7 +2841,6 @@ NdisOpenFile(status, filehandle, filelen
 	/* Get the file size. */
 	VOP_GETATTR(nd.ni_vp, vap, td->td_ucred);
 	VOP_UNLOCK(nd.ni_vp, 0);
-	VFS_UNLOCK_GIANT(vfslocked);
 
 	fh->nf_vp = nd.ni_vp;
 	fh->nf_map = NULL;
@@ -2862,7 +2860,7 @@ NdisMapFile(status, mappedbuffer, fileha
 	struct thread		*td = curthread;
 	linker_file_t		lf;
 	caddr_t			kldstart;
-	int			error, vfslocked;
+	int			error;
 	ssize_t			resid;
 	struct vnode		*vp;
 
@@ -2903,10 +2901,8 @@ NdisMapFile(status, mappedbuffer, fileha
 	}
 
 	vp = fh->nf_vp;
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	error = vn_rdwr(UIO_READ, vp, fh->nf_map, fh->nf_maplen, 0,
 	    UIO_SYSSPACE, 0, td->td_ucred, NOCRED, &resid, td);
-	VFS_UNLOCK_GIANT(vfslocked);
 
 	if (error)
 		*status = NDIS_STATUS_FAILURE;
@@ -2937,7 +2933,6 @@ NdisCloseFile(filehandle)
 {
 	struct thread		*td = curthread;
 	ndis_fh			*fh;
-	int			vfslocked;
 	struct vnode		*vp;
 
 	if (filehandle == NULL)
@@ -2955,9 +2950,7 @@ NdisCloseFile(filehandle)
 
 	if (fh->nf_type == NDIS_FH_TYPE_VFS) {
 		vp = fh->nf_vp;
-		vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 		vn_close(vp, FREAD, td->td_ucred, td);
-		VFS_UNLOCK_GIANT(vfslocked);
 	}
 
 	fh->nf_vp = NULL;

Modified: head/sys/compat/svr4/svr4_misc.c
==============================================================================
--- head/sys/compat/svr4/svr4_misc.c	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/compat/svr4/svr4_misc.c	Mon Oct 22 17:50:54 2012	(r241896)
@@ -241,7 +241,7 @@ svr4_sys_getdents64(td, uap)
 	struct iovec aiov;
 	off_t off;
 	struct svr4_dirent64 svr4_dirent;
-	int buflen, error, eofflag, nbytes, justone, vfslocked;
+	int buflen, error, eofflag, nbytes, justone;
 	u_long *cookies = NULL, *cookiep;
 	int ncookies;
 
@@ -258,9 +258,7 @@ svr4_sys_getdents64(td, uap)
 	}
 
 	vp = fp->f_vnode;
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	if (vp->v_type != VDIR) {
-		VFS_UNLOCK_GIANT(vfslocked);
 		fdrop(fp, td);
 		return (EINVAL);
 	}
@@ -397,7 +395,6 @@ eof:
 	td->td_retval[0] = nbytes - resid;
 out:
 	VOP_UNLOCK(vp, 0);
-	VFS_UNLOCK_GIANT(vfslocked);
 	fdrop(fp, td);
 	if (cookies)
 		free(cookies, M_TEMP);
@@ -422,7 +419,7 @@ svr4_sys_getdents(td, uap)
 	struct iovec aiov;
 	struct svr4_dirent idb;
 	off_t off;		/* true file offset */
-	int buflen, error, eofflag, vfslocked;
+	int buflen, error, eofflag;
 	u_long *cookiebuf = NULL, *cookie;
 	int ncookies = 0, *retval = td->td_retval;
 
@@ -439,9 +436,7 @@ svr4_sys_getdents(td, uap)
 	}
 
 	vp = fp->f_vnode;
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	if (vp->v_type != VDIR) {
-		VFS_UNLOCK_GIANT(vfslocked);
 		fdrop(fp, td);
 		return (EINVAL);
 	}
@@ -534,7 +529,6 @@ eof:
 	*retval = uap->nbytes - resid;
 out:
 	VOP_UNLOCK(vp, 0);
-	VFS_UNLOCK_GIANT(vfslocked);
 	fdrop(fp, td);
 	if (cookiebuf)
 		free(cookiebuf, M_TEMP);
@@ -614,7 +608,7 @@ svr4_sys_fchroot(td, uap)
 	struct filedesc	*fdp = td->td_proc->p_fd;
 	struct vnode	*vp;
 	struct file	*fp;
-	int		 error, vfslocked;
+	int		 error;
 
 	if ((error = priv_check(td, PRIV_VFS_FCHROOT)) != 0)
 		return error;
@@ -624,7 +618,6 @@ svr4_sys_fchroot(td, uap)
 	vp = fp->f_vnode;
 	VREF(vp);
 	fdrop(fp, td);
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	error = change_dir(vp, td);
 	if (error)
@@ -637,11 +630,9 @@ svr4_sys_fchroot(td, uap)
 	VOP_UNLOCK(vp, 0);
 	error = change_root(vp, td);
 	vrele(vp);
-	VFS_UNLOCK_GIANT(vfslocked);
 	return (error);
 fail:
 	vput(vp);
-	VFS_UNLOCK_GIANT(vfslocked);
 	return (error);
 }
 
@@ -1652,13 +1643,12 @@ svr4_sys_resolvepath(td, uap)
 	int error, *retval = td->td_retval;
 	unsigned int ncopy;
 
-	NDINIT(&nd, LOOKUP, NOFOLLOW | SAVENAME | MPSAFE, UIO_USERSPACE,
+	NDINIT(&nd, LOOKUP, NOFOLLOW | SAVENAME, UIO_USERSPACE,
 	    uap->path, td);
 
 	if ((error = namei(&nd)) != 0)
 		return (error);
 	NDFREE(&nd, NDF_NO_FREE_PNBUF);
-	VFS_UNLOCK_GIANT(NDHASGIANT(&nd));
 
 	ncopy = min(uap->bufsiz, strlen(nd.ni_cnd.cn_pnbuf) + 1);
 	if ((error = copyout(nd.ni_cnd.cn_pnbuf, uap->buf, ncopy)) != 0)

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/conf/NOTES	Mon Oct 22 17:50:54 2012	(r241896)
@@ -1088,9 +1088,6 @@ options 	REISERFS
 # unsuitable for inclusion on machines with untrusted local users.
 options 	VFS_AIO
 
-# Enable mounting of non-MPSAFE filesystems.
-options 	VFS_ALLOW_NONMPSAFE
-
 # Cryptographically secure random number generator; /dev/random
 device		random
 

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/conf/options	Mon Oct 22 17:50:54 2012	(r241896)
@@ -188,7 +188,6 @@ SW_WATCHDOG	opt_watchdog.h
 TURNSTILE_PROFILING
 UMTX_PROFILING
 VFS_AIO
-VFS_ALLOW_NONMPSAFE
 VERBOSE_SYSINIT	opt_global.h
 WLCACHE		opt_wavelan.h
 WLDEBUG		opt_wavelan.h

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mod.c	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/dev/hwpmc/hwpmc_mod.c	Mon Oct 22 17:50:54 2012	(r241896)
@@ -1632,7 +1632,6 @@ pmc_log_kernel_mappings(struct pmc *pm)
 static void
 pmc_log_process_mappings(struct pmc_owner *po, struct proc *p)
 {
-	int locked;
 	vm_map_t map;
 	struct vnode *vp;
 	struct vmspace *vm;
@@ -1742,9 +1741,7 @@ pmc_log_process_mappings(struct pmc_owne
 		pmc_getfilename(vp, &fullpath, &freepath);
 		last_vp = vp;
 
-		locked = VFS_LOCK_GIANT(vp->v_mount);
 		vrele(vp);
-		VFS_UNLOCK_GIANT(locked);
 
 		vp = NULL;
 		pmclog_process_map_in(po, p->p_pid, start_addr, fullpath);

Modified: head/sys/dev/md/md.c
==============================================================================
--- head/sys/dev/md/md.c	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/dev/md/md.c	Mon Oct 22 17:50:54 2012	(r241896)
@@ -512,7 +512,7 @@ mdstart_preload(struct md_s *sc, struct 
 static int
 mdstart_vnode(struct md_s *sc, struct bio *bp)
 {
-	int error, vfslocked;
+	int error;
 	struct uio auio;
 	struct iovec aiov;
 	struct mount *mp;
@@ -542,13 +542,11 @@ mdstart_vnode(struct md_s *sc, struct bi
 	 */
 
 	if (bp->bio_cmd == BIO_FLUSH) {
-		vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 		(void) vn_start_write(vp, &mp, V_WAIT);
 		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 		error = VOP_FSYNC(vp, MNT_WAIT, td);
 		VOP_UNLOCK(vp, 0);
 		vn_finished_write(mp);
-		VFS_UNLOCK_GIANT(vfslocked);
 		return (error);
 	}
 
@@ -570,7 +568,6 @@ mdstart_vnode(struct md_s *sc, struct bi
 		auio.uio_rw = UIO_WRITE;
 		auio.uio_td = td;
 		end = bp->bio_offset + bp->bio_length;
-		vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 		(void) vn_start_write(vp, &mp, V_WAIT);
 		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 		error = 0;
@@ -588,7 +585,6 @@ mdstart_vnode(struct md_s *sc, struct bi
 		VOP_UNLOCK(vp, 0);
 		vn_finished_write(mp);
 		bp->bio_resid = end - auio.uio_offset;
-		VFS_UNLOCK_GIANT(vfslocked);
 		return (error);
 	}
 
@@ -610,7 +606,6 @@ mdstart_vnode(struct md_s *sc, struct bi
 	 * When reading set IO_DIRECT to try to avoid double-caching
 	 * the data.  When writing IO_DIRECT is not optimal.
 	 */
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	if (bp->bio_cmd == BIO_READ) {
 		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 		error = VOP_READ(vp, &auio, IO_DIRECT, sc->cred);
@@ -623,7 +618,6 @@ mdstart_vnode(struct md_s *sc, struct bi
 		VOP_UNLOCK(vp, 0);
 		vn_finished_write(mp);
 	}
-	VFS_UNLOCK_GIANT(vfslocked);
 	bp->bio_resid = auio.uio_resid;
 	return (error);
 }
@@ -957,7 +951,7 @@ mdcreate_vnode(struct md_s *sc, struct m
 	struct vattr vattr;
 	struct nameidata nd;
 	char *fname;
-	int error, flags, vfslocked;
+	int error, flags;
 
 	/*
 	 * Kernel-originated requests must have the filename appended
@@ -976,11 +970,10 @@ mdcreate_vnode(struct md_s *sc, struct m
 	 * set the FWRITE mask before trying to open the backing store.
 	 */
 	flags = FREAD | ((mdio->md_options & MD_READONLY) ? 0 : FWRITE);
-	NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, sc->file, td);
+	NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, sc->file, td);
 	error = vn_open(&nd, &flags, 0, NULL);
 	if (error != 0)
 		return (error);
-	vfslocked = NDHASGIANT(&nd);
 	NDFREE(&nd, NDF_ONLY_PNBUF);
 	if (nd.ni_vp->v_type != VREG) {
 		error = EINVAL;
@@ -1016,19 +1009,16 @@ mdcreate_vnode(struct md_s *sc, struct m
 		nd.ni_vp->v_vflag &= ~VV_MD;
 		goto bad;
 	}
-	VFS_UNLOCK_GIANT(vfslocked);
 	return (0);
 bad:
 	VOP_UNLOCK(nd.ni_vp, 0);
 	(void)vn_close(nd.ni_vp, flags, td->td_ucred, td);
-	VFS_UNLOCK_GIANT(vfslocked);
 	return (error);
 }
 
 static int
 mddestroy(struct md_s *sc, struct thread *td)
 {
-	int vfslocked;
 
 	if (sc->gp) {
 		sc->gp->softc = NULL;
@@ -1050,13 +1040,11 @@ mddestroy(struct md_s *sc, struct thread
 	mtx_unlock(&sc->queue_mtx);
 	mtx_destroy(&sc->queue_mtx);
 	if (sc->vnode != NULL) {
-		vfslocked = VFS_LOCK_GIANT(sc->vnode->v_mount);
 		vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY);
 		sc->vnode->v_vflag &= ~VV_MD;
 		VOP_UNLOCK(sc->vnode, 0);
 		(void)vn_close(sc->vnode, sc->flags & MD_READONLY ?
 		    FREAD : (FREAD|FWRITE), sc->cred, td);
-		VFS_UNLOCK_GIANT(vfslocked);
 	}
 	if (sc->cred != NULL)
 		crfree(sc->cred);

Modified: head/sys/dev/nand/nandsim_swap.c
==============================================================================
--- head/sys/dev/nand/nandsim_swap.c	Mon Oct 22 17:47:37 2012	(r241895)
+++ head/sys/dev/nand/nandsim_swap.c	Mon Oct 22 17:50:54 2012	(r241896)
@@ -142,9 +142,9 @@ static int
 swap_file_open(struct chip_swap *swap, const char *swap_file)
 {
 	struct nameidata nd;
-	int vfslocked, flags, error;
+	int flags, error;
 
-	NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, swap_file,
+	NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, swap_file,
 	    curthread);
 
 	flags = FWRITE | FREAD | O_NOFOLLOW | O_CREAT | O_TRUNC;
@@ -157,12 +157,10 @@ swap_file_open(struct chip_swap *swap, c
 	}
 
 	swap->swap_cred = crhold(curthread->td_ucred);
-	vfslocked = NDHASGIANT(&nd);
 	NDFREE(&nd, NDF_ONLY_PNBUF);
 
 	/* We just unlock so we hold a reference */
 	VOP_UNLOCK(nd.ni_vp, 0);
-	VFS_UNLOCK_GIANT(vfslocked);
 
 	swap->swap_vp = nd.ni_vp;
 
@@ -192,7 +190,6 @@ swap_file_write(struct chip_swap *swap, 
 	struct vnode *vp;
 	struct uio auio;
 	struct iovec aiov;
-	int vfslocked;
 
 	if (swap == NULL || blk_state == NULL)
 		return (-1);
@@ -222,13 +219,11 @@ swap_file_write(struct chip_swap *swap, 
 	auio.uio_resid = swap->blk_size;
 	auio.uio_td = td;
 
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	vn_start_write(vp, &mp, V_WAIT);
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	VOP_WRITE(vp, &auio, IO_UNIT, swap->swap_cred);
 	VOP_UNLOCK(vp, 0);
 	vn_finished_write(mp);
-	VFS_UNLOCK_GIANT(vfslocked);
 
 	return (0);
 }
@@ -241,7 +236,6 @@ swap_file_read(struct chip_swap *swap, s
 	struct vnode *vp;
 	struct uio auio;
 	struct iovec aiov;
-	int vfslocked;
 
 	if (swap == NULL || blk_state == NULL)
 		return (-1);
@@ -267,11 +261,9 @@ swap_file_read(struct chip_swap *swap, s
 	auio.uio_resid = swap->blk_size;
 	auio.uio_td = td;
 
-	vfslocked = VFS_LOCK_GIANT(vp->v_mount);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210221750.q9MHot26061585>