diff options
author | kib <kib@FreeBSD.org> | 2012-10-22 17:50:54 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2012-10-22 17:50:54 +0000 |
commit | 560aa751e0f5cfef868bdf3fab01cdbc5169ef82 (patch) | |
tree | 6e9ef0a47c5e91d26227820c50c9767e84550821 /sys/kern/kern_jail.c | |
parent | ca71b68ea40c83f641d6485e027368568f244197 (diff) | |
download | FreeBSD-src-560aa751e0f5cfef868bdf3fab01cdbc5169ef82.zip FreeBSD-src-560aa751e0f5cfef868bdf3fab01cdbc5169ef82.tar.gz |
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
Diffstat (limited to 'sys/kern/kern_jail.c')
-rw-r--r-- | sys/kern/kern_jail.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 4639e3c..2ff64d5 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -543,7 +543,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) int created, cuflags, descend, enforce, error, errmsg_len, errmsg_pos; int gotchildmax, gotenforce, gothid, gotrsnum, gotslevel; int fi, jid, jsys, len, level; - int childmax, rsnum, slevel, vfslocked; + int childmax, rsnum, slevel; int fullpath_disabled; #if defined(INET) || defined(INET6) int ii, ij; @@ -921,12 +921,11 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) error = EINVAL; goto done_free; } - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE, UIO_SYSSPACE, + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, path, td); error = namei(&nd); if (error) goto done_free; - vfslocked = NDHASGIANT(&nd); root = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); g_path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); @@ -941,17 +940,14 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) path = NULL; } else { /* exit on other errors */ - VFS_UNLOCK_GIANT(vfslocked); goto done_free; } if (root->v_type != VDIR) { error = ENOTDIR; vput(root); - VFS_UNLOCK_GIANT(vfslocked); goto done_free; } VOP_UNLOCK(root, 0); - VFS_UNLOCK_GIANT(vfslocked); if (fullpath_disabled) { /* Leave room for a real-root full pathname. */ if (len + (path[0] == '/' && strcmp(mypr->pr_path, "/") @@ -1852,11 +1848,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) done_unlock_list: sx_xunlock(&allprison_lock); done_releroot: - if (root != NULL) { - vfslocked = VFS_LOCK_GIANT(root->v_mount); + if (root != NULL) vrele(root); - VFS_UNLOCK_GIANT(vfslocked); - } done_errmsg: if (error) { vfs_getopt(opts, "errmsg", (void **)&errmsg, &errmsg_len); @@ -2337,7 +2330,7 @@ do_jail_attach(struct thread *td, struct prison *pr) struct prison *ppr; struct proc *p; struct ucred *newcred, *oldcred; - int vfslocked, error; + int error; /* * XXX: Note that there is a slight race here if two threads @@ -2368,7 +2361,6 @@ do_jail_attach(struct thread *td, struct prison *pr) if (error) goto e_revert_osd; - vfslocked = VFS_LOCK_GIANT(pr->pr_root->v_mount); vn_lock(pr->pr_root, LK_EXCLUSIVE | LK_RETRY); if ((error = change_dir(pr->pr_root, td)) != 0) goto e_unlock; @@ -2378,8 +2370,7 @@ do_jail_attach(struct thread *td, struct prison *pr) #endif VOP_UNLOCK(pr->pr_root, 0); if ((error = change_root(pr->pr_root, td))) - goto e_unlock_giant; - VFS_UNLOCK_GIANT(vfslocked); + goto e_revert_osd; newcred = crget(); PROC_LOCK(p); @@ -2397,8 +2388,6 @@ do_jail_attach(struct thread *td, struct prison *pr) return (0); e_unlock: VOP_UNLOCK(pr->pr_root, 0); - e_unlock_giant: - VFS_UNLOCK_GIANT(vfslocked); e_revert_osd: /* Tell modules this thread is still in its old jail after all. */ (void)osd_jail_call(ppr, PR_METHOD_ATTACH, td); @@ -2547,7 +2536,6 @@ static void prison_deref(struct prison *pr, int flags) { struct prison *ppr, *tpr; - int vfslocked; if (!(flags & PD_LOCKED)) mtx_lock(&pr->pr_mtx); @@ -2588,11 +2576,8 @@ prison_deref(struct prison *pr, int flags) if (pr->pr_vnet != ppr->pr_vnet) vnet_destroy(pr->pr_vnet); #endif - if (pr->pr_root != NULL) { - vfslocked = VFS_LOCK_GIANT(pr->pr_root->v_mount); + if (pr->pr_root != NULL) vrele(pr->pr_root); - VFS_UNLOCK_GIANT(vfslocked); - } mtx_destroy(&pr->pr_mtx); #ifdef INET free(pr->pr_ip4, M_PRISON); |