summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_acl.c
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/kern/vfs_acl.c
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/kern/vfs_acl.c')
-rw-r--r--sys/kern/vfs_acl.c64
1 files changed, 20 insertions, 44 deletions
diff --git a/sys/kern/vfs_acl.c b/sys/kern/vfs_acl.c
index 2516d5c..6d04b04 100644
--- a/sys/kern/vfs_acl.c
+++ b/sys/kern/vfs_acl.c
@@ -327,16 +327,14 @@ int
sys___acl_get_file(struct thread *td, struct __acl_get_file_args *uap)
{
struct nameidata nd;
- int vfslocked, error;
+ int error;
- NDINIT(&nd, LOOKUP, MPSAFE|FOLLOW, UIO_USERSPACE, uap->path, td);
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
error = namei(&nd);
- vfslocked = NDHASGIANT(&nd);
if (error == 0) {
error = vacl_get_acl(td, nd.ni_vp, uap->type, uap->aclp);
NDFREE(&nd, 0);
}
- VFS_UNLOCK_GIANT(vfslocked);
return (error);
}
@@ -347,16 +345,14 @@ int
sys___acl_get_link(struct thread *td, struct __acl_get_link_args *uap)
{
struct nameidata nd;
- int vfslocked, error;
+ int error;
- NDINIT(&nd, LOOKUP, MPSAFE|NOFOLLOW, UIO_USERSPACE, uap->path, td);
+ NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
error = namei(&nd);
- vfslocked = NDHASGIANT(&nd);
if (error == 0) {
error = vacl_get_acl(td, nd.ni_vp, uap->type, uap->aclp);
NDFREE(&nd, 0);
}
- VFS_UNLOCK_GIANT(vfslocked);
return (error);
}
@@ -367,16 +363,14 @@ int
sys___acl_set_file(struct thread *td, struct __acl_set_file_args *uap)
{
struct nameidata nd;
- int vfslocked, error;
+ int error;
- NDINIT(&nd, LOOKUP, MPSAFE|FOLLOW, UIO_USERSPACE, uap->path, td);
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
error = namei(&nd);
- vfslocked = NDHASGIANT(&nd);
if (error == 0) {
error = vacl_set_acl(td, nd.ni_vp, uap->type, uap->aclp);
NDFREE(&nd, 0);
}
- VFS_UNLOCK_GIANT(vfslocked);
return (error);
}
@@ -387,16 +381,14 @@ int
sys___acl_set_link(struct thread *td, struct __acl_set_link_args *uap)
{
struct nameidata nd;
- int vfslocked, error;
+ int error;
- NDINIT(&nd, LOOKUP, MPSAFE|NOFOLLOW, UIO_USERSPACE, uap->path, td);
+ NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
error = namei(&nd);
- vfslocked = NDHASGIANT(&nd);
if (error == 0) {
error = vacl_set_acl(td, nd.ni_vp, uap->type, uap->aclp);
NDFREE(&nd, 0);
}
- VFS_UNLOCK_GIANT(vfslocked);
return (error);
}
@@ -407,14 +399,12 @@ int
sys___acl_get_fd(struct thread *td, struct __acl_get_fd_args *uap)
{
struct file *fp;
- int vfslocked, error;
+ int error;
error = getvnode(td->td_proc->p_fd, uap->filedes, CAP_ACL_GET, &fp);
if (error == 0) {
- vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount);
error = vacl_get_acl(td, fp->f_vnode, uap->type, uap->aclp);
fdrop(fp, td);
- VFS_UNLOCK_GIANT(vfslocked);
}
return (error);
}
@@ -426,14 +416,12 @@ int
sys___acl_set_fd(struct thread *td, struct __acl_set_fd_args *uap)
{
struct file *fp;
- int vfslocked, error;
+ int error;
error = getvnode(td->td_proc->p_fd, uap->filedes, CAP_ACL_SET, &fp);
if (error == 0) {
- vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount);
error = vacl_set_acl(td, fp->f_vnode, uap->type, uap->aclp);
fdrop(fp, td);
- VFS_UNLOCK_GIANT(vfslocked);
}
return (error);
}
@@ -445,16 +433,14 @@ int
sys___acl_delete_file(struct thread *td, struct __acl_delete_file_args *uap)
{
struct nameidata nd;
- int vfslocked, error;
+ int error;
- NDINIT(&nd, LOOKUP, MPSAFE|FOLLOW, UIO_USERSPACE, uap->path, td);
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
error = namei(&nd);
- vfslocked = NDHASGIANT(&nd);
if (error == 0) {
error = vacl_delete(td, nd.ni_vp, uap->type);
NDFREE(&nd, 0);
}
- VFS_UNLOCK_GIANT(vfslocked);
return (error);
}
@@ -465,16 +451,14 @@ int
sys___acl_delete_link(struct thread *td, struct __acl_delete_link_args *uap)
{
struct nameidata nd;
- int vfslocked, error;
+ int error;
- NDINIT(&nd, LOOKUP, MPSAFE|NOFOLLOW, UIO_USERSPACE, uap->path, td);
+ NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
error = namei(&nd);
- vfslocked = NDHASGIANT(&nd);
if (error == 0) {
error = vacl_delete(td, nd.ni_vp, uap->type);
NDFREE(&nd, 0);
}
- VFS_UNLOCK_GIANT(vfslocked);
return (error);
}
@@ -485,15 +469,13 @@ int
sys___acl_delete_fd(struct thread *td, struct __acl_delete_fd_args *uap)
{
struct file *fp;
- int vfslocked, error;
+ int error;
error = getvnode(td->td_proc->p_fd, uap->filedes, CAP_ACL_DELETE,
&fp);
if (error == 0) {
- vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount);
error = vacl_delete(td, fp->f_vnode, uap->type);
fdrop(fp, td);
- VFS_UNLOCK_GIANT(vfslocked);
}
return (error);
}
@@ -505,16 +487,14 @@ int
sys___acl_aclcheck_file(struct thread *td, struct __acl_aclcheck_file_args *uap)
{
struct nameidata nd;
- int vfslocked, error;
+ int error;
- NDINIT(&nd, LOOKUP, MPSAFE|FOLLOW, UIO_USERSPACE, uap->path, td);
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
error = namei(&nd);
- vfslocked = NDHASGIANT(&nd);
if (error == 0) {
error = vacl_aclcheck(td, nd.ni_vp, uap->type, uap->aclp);
NDFREE(&nd, 0);
}
- VFS_UNLOCK_GIANT(vfslocked);
return (error);
}
@@ -525,16 +505,14 @@ int
sys___acl_aclcheck_link(struct thread *td, struct __acl_aclcheck_link_args *uap)
{
struct nameidata nd;
- int vfslocked, error;
+ int error;
- NDINIT(&nd, LOOKUP, MPSAFE|NOFOLLOW, UIO_USERSPACE, uap->path, td);
+ NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
error = namei(&nd);
- vfslocked = NDHASGIANT(&nd);
if (error == 0) {
error = vacl_aclcheck(td, nd.ni_vp, uap->type, uap->aclp);
NDFREE(&nd, 0);
}
- VFS_UNLOCK_GIANT(vfslocked);
return (error);
}
@@ -545,15 +523,13 @@ int
sys___acl_aclcheck_fd(struct thread *td, struct __acl_aclcheck_fd_args *uap)
{
struct file *fp;
- int vfslocked, error;
+ int error;
error = getvnode(td->td_proc->p_fd, uap->filedes, CAP_ACL_CHECK,
&fp);
if (error == 0) {
- vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount);
error = vacl_aclcheck(td, fp->f_vnode, uap->type, uap->aclp);
fdrop(fp, td);
- VFS_UNLOCK_GIANT(vfslocked);
}
return (error);
}
OpenPOWER on IntegriCloud