summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-10-22 17:50:54 +0000
committerkib <kib@FreeBSD.org>2012-10-22 17:50:54 +0000
commit560aa751e0f5cfef868bdf3fab01cdbc5169ef82 (patch)
tree6e9ef0a47c5e91d26227820c50c9767e84550821 /sys/compat
parentca71b68ea40c83f641d6485e027368568f244197 (diff)
downloadFreeBSD-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/compat')
-rw-r--r--sys/compat/linprocfs/linprocfs.c9
-rw-r--r--sys/compat/linux/linux_file.c5
-rw-r--r--sys/compat/linux/linux_misc.c11
-rw-r--r--sys/compat/ndis/subr_ndis.c13
-rw-r--r--sys/compat/svr4/svr4_misc.c18
5 files changed, 13 insertions, 43 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
index 3adbe96..31cda7d 100644
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -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;
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 8003ade..df13277 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -337,7 +337,7 @@ getdents_common(struct thread *td, struct linux_getdents64_args *args,
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, struct linux_getdents64_args *args,
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);
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 50e2175..6da3b19 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -247,7 +247,7 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
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 linux_uselib_args *args)
#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 linux_uselib_args *args)
goto cleanup;
vp = ni.ni_vp;
- vfslocked = NDHASGIANT(&ni);
NDFREE(&ni, NDF_ONLY_PNBUF);
/*
@@ -393,7 +391,6 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
*/
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 linux_uselib_args *args)
cleanup:
/* Unlock vnode if needed */
- if (locked) {
+ if (locked)
VOP_UNLOCK(vp, 0);
- VFS_UNLOCK_GIANT(vfslocked);
- }
/* Release the temporary mapping. */
if (a_out)
diff --git a/sys/compat/ndis/subr_ndis.c b/sys/compat/ndis/subr_ndis.c
index da68052..bc13b2f 100644
--- a/sys/compat/ndis/subr_ndis.c
+++ b/sys/compat/ndis/subr_ndis.c
@@ -2741,7 +2741,7 @@ NdisOpenFile(status, filehandle, filelength, filename, highestaddr)
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, filelength, filename, highestaddr)
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, filelength, filename, highestaddr)
free(afilename, M_DEVBUF);
return;
}
- vfslocked = NDHASGIANT(&nd);
ExFreePool(path);
@@ -2842,7 +2841,6 @@ NdisOpenFile(status, filehandle, filelength, filename, highestaddr)
/* 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, filehandle)
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, filehandle)
}
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;
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c
index 8456e10..d6bc4eb 100644
--- a/sys/compat/svr4/svr4_misc.c
+++ b/sys/compat/svr4/svr4_misc.c
@@ -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)
OpenPOWER on IntegriCloud