o Change locking rules for VOP_GETACL() to indicate that vnode locks

must be held when retrieving ACLs from vnodes.  This is required for
  EA-based UFS ACL implementations.
o Update vacl_get_acl() so that it does appropriate vnode locking.
o Remove static from M_ACL malloc define so that it is accessible for
  consumers of ACLs other than in kern_acl.c

Obtained from:	TrustedBSD Project
This commit is contained in:
rwatson 2000-09-21 18:43:32 +00:00
parent 56361a3580
commit 7a15f349da
4 changed files with 13 additions and 4 deletions

View File

@ -46,7 +46,7 @@
#include <sys/stat.h>
#include <sys/acl.h>
static MALLOC_DEFINE(M_ACL, "acl", "access control list");
MALLOC_DEFINE(M_ACL, "acl", "access control list");
static int vacl_set_acl(struct proc *p, struct vnode *vp, acl_type_t type,
struct acl *aclp);
@ -94,7 +94,10 @@ vacl_get_acl(struct proc *p, struct vnode *vp, acl_type_t type,
struct acl inkernelacl;
int error;
VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
error = VOP_GETACL(vp, type, &inkernelacl, p->p_ucred, p);
VOP_UNLOCK(vp, 0, p);
if (error == 0)
error = copyout(&inkernelacl, aclp, sizeof(struct acl));
return (error);

View File

@ -46,7 +46,7 @@
#include <sys/stat.h>
#include <sys/acl.h>
static MALLOC_DEFINE(M_ACL, "acl", "access control list");
MALLOC_DEFINE(M_ACL, "acl", "access control list");
static int vacl_set_acl(struct proc *p, struct vnode *vp, acl_type_t type,
struct acl *aclp);
@ -94,7 +94,10 @@ vacl_get_acl(struct proc *p, struct vnode *vp, acl_type_t type,
struct acl inkernelacl;
int error;
VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
error = VOP_GETACL(vp, type, &inkernelacl, p->p_ucred, p);
VOP_UNLOCK(vp, 0, p);
if (error == 0)
error = copyout(&inkernelacl, aclp, sizeof(struct acl));
return (error);

View File

@ -46,7 +46,7 @@
#include <sys/stat.h>
#include <sys/acl.h>
static MALLOC_DEFINE(M_ACL, "acl", "access control list");
MALLOC_DEFINE(M_ACL, "acl", "access control list");
static int vacl_set_acl(struct proc *p, struct vnode *vp, acl_type_t type,
struct acl *aclp);
@ -94,7 +94,10 @@ vacl_get_acl(struct proc *p, struct vnode *vp, acl_type_t type,
struct acl inkernelacl;
int error;
VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
error = VOP_GETACL(vp, type, &inkernelacl, p->p_ucred, p);
VOP_UNLOCK(vp, 0, p);
if (error == 0)
error = copyout(&inkernelacl, aclp, sizeof(struct acl));
return (error);

View File

@ -502,7 +502,7 @@ vop_bwrite {
};
#
#% getacl vp = = =
#% getacl vp L L L
#
vop_getacl {
IN struct vnode *vp;