summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2002-02-04 17:58:15 +0000
committerrwatson <rwatson@FreeBSD.org>2002-02-04 17:58:15 +0000
commit10b6b09b2507d353917c4e17172191b354c38753 (patch)
tree139500a0daecfd8dcaac08bc2b79c41bcab8380b /sys
parentc51975ac283c202c63ea7f6b8aea02f6e00b3115 (diff)
downloadFreeBSD-src-10b6b09b2507d353917c4e17172191b354c38753.zip
FreeBSD-src-10b6b09b2507d353917c4e17172191b354c38753.tar.gz
o Scatter vn_start_write() and vn_finished_write() through ACL code so
that it interacts properly with snapshotting. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_acl.c13
-rw-r--r--sys/kern/subr_acl_posix1e.c13
-rw-r--r--sys/kern/vfs_acl.c13
3 files changed, 30 insertions, 9 deletions
diff --git a/sys/kern/kern_acl.c b/sys/kern/kern_acl.c
index a42fe14..e7937bb 100644
--- a/sys/kern/kern_acl.c
+++ b/sys/kern/kern_acl.c
@@ -30,9 +30,6 @@
/*
* Developed by the TrustedBSD Project.
* Support for POSIX.1e access control lists.
- *
- * XXX: When vn_start_write() was scattered throughout the kernel, it
- * was not scattered here for some reason. It needs to be.
*/
#include "opt_cap.h"
@@ -573,15 +570,20 @@ vacl_set_acl(struct thread *td, struct vnode *vp, acl_type_t type,
struct acl *aclp)
{
struct acl inkernacl;
+ struct mount *mp;
int error;
error = copyin(aclp, &inkernacl, sizeof(struct acl));
if (error)
return(error);
+ error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
+ if (error != 0)
+ return (error);
VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_SETACL(vp, type, &inkernacl, td->td_proc->p_ucred, td);
VOP_UNLOCK(vp, 0, td);
+ vn_finished_write(mp);
return(error);
}
@@ -610,13 +612,18 @@ vacl_get_acl(struct thread *td, struct vnode *vp, acl_type_t type,
static int
vacl_delete(struct thread *td, struct vnode *vp, acl_type_t type)
{
+ struct mount *mp;
int error;
+ error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
+ if (error)
+ return (error);
VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_SETACL(vp, ACL_TYPE_DEFAULT, 0, td->td_proc->p_ucred,
td);
VOP_UNLOCK(vp, 0, td);
+ vn_finished_write(mp);
return (error);
}
diff --git a/sys/kern/subr_acl_posix1e.c b/sys/kern/subr_acl_posix1e.c
index a42fe14..e7937bb 100644
--- a/sys/kern/subr_acl_posix1e.c
+++ b/sys/kern/subr_acl_posix1e.c
@@ -30,9 +30,6 @@
/*
* Developed by the TrustedBSD Project.
* Support for POSIX.1e access control lists.
- *
- * XXX: When vn_start_write() was scattered throughout the kernel, it
- * was not scattered here for some reason. It needs to be.
*/
#include "opt_cap.h"
@@ -573,15 +570,20 @@ vacl_set_acl(struct thread *td, struct vnode *vp, acl_type_t type,
struct acl *aclp)
{
struct acl inkernacl;
+ struct mount *mp;
int error;
error = copyin(aclp, &inkernacl, sizeof(struct acl));
if (error)
return(error);
+ error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
+ if (error != 0)
+ return (error);
VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_SETACL(vp, type, &inkernacl, td->td_proc->p_ucred, td);
VOP_UNLOCK(vp, 0, td);
+ vn_finished_write(mp);
return(error);
}
@@ -610,13 +612,18 @@ vacl_get_acl(struct thread *td, struct vnode *vp, acl_type_t type,
static int
vacl_delete(struct thread *td, struct vnode *vp, acl_type_t type)
{
+ struct mount *mp;
int error;
+ error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
+ if (error)
+ return (error);
VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_SETACL(vp, ACL_TYPE_DEFAULT, 0, td->td_proc->p_ucred,
td);
VOP_UNLOCK(vp, 0, td);
+ vn_finished_write(mp);
return (error);
}
diff --git a/sys/kern/vfs_acl.c b/sys/kern/vfs_acl.c
index a42fe14..e7937bb 100644
--- a/sys/kern/vfs_acl.c
+++ b/sys/kern/vfs_acl.c
@@ -30,9 +30,6 @@
/*
* Developed by the TrustedBSD Project.
* Support for POSIX.1e access control lists.
- *
- * XXX: When vn_start_write() was scattered throughout the kernel, it
- * was not scattered here for some reason. It needs to be.
*/
#include "opt_cap.h"
@@ -573,15 +570,20 @@ vacl_set_acl(struct thread *td, struct vnode *vp, acl_type_t type,
struct acl *aclp)
{
struct acl inkernacl;
+ struct mount *mp;
int error;
error = copyin(aclp, &inkernacl, sizeof(struct acl));
if (error)
return(error);
+ error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
+ if (error != 0)
+ return (error);
VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_SETACL(vp, type, &inkernacl, td->td_proc->p_ucred, td);
VOP_UNLOCK(vp, 0, td);
+ vn_finished_write(mp);
return(error);
}
@@ -610,13 +612,18 @@ vacl_get_acl(struct thread *td, struct vnode *vp, acl_type_t type,
static int
vacl_delete(struct thread *td, struct vnode *vp, acl_type_t type)
{
+ struct mount *mp;
int error;
+ error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
+ if (error)
+ return (error);
VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_SETACL(vp, ACL_TYPE_DEFAULT, 0, td->td_proc->p_ucred,
td);
VOP_UNLOCK(vp, 0, td);
+ vn_finished_write(mp);
return (error);
}
OpenPOWER on IntegriCloud