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:
parent
56361a3580
commit
7a15f349da
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -502,7 +502,7 @@ vop_bwrite {
|
||||
};
|
||||
|
||||
#
|
||||
#% getacl vp = = =
|
||||
#% getacl vp L L L
|
||||
#
|
||||
vop_getacl {
|
||||
IN struct vnode *vp;
|
||||
|
Loading…
Reference in New Issue
Block a user