summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mac.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2002-08-04 10:29:36 +0000
committerjeff <jeff@FreeBSD.org>2002-08-04 10:29:36 +0000
commit02517b6731ab2da44ce9b49260429744cf0114d5 (patch)
treee889f56910bf98cbee3be239655a9e4bbb928b2e /sys/kern/kern_mac.c
parenta03ca02ee99a255a2c14a75ff8eb488960b13ea7 (diff)
downloadFreeBSD-src-02517b6731ab2da44ce9b49260429744cf0114d5.zip
FreeBSD-src-02517b6731ab2da44ce9b49260429744cf0114d5.tar.gz
- Replace v_flag with v_iflag and v_vflag
- v_vflag is protected by the vnode lock and is used when synchronization with VOP calls is needed. - v_iflag is protected by interlock and is used for dealing with vnode management issues. These flags include X/O LOCK, FREE, DOOMED, etc. - All accesses to v_iflag and v_vflag have either been locked or marked with mp_fixme's. - Many ASSERT_VOP_LOCKED calls have been added where the locking was not clear. - Many functions in vfs_subr.c were restructured to provide for stronger locking. Idea stolen from: BSD/OS
Diffstat (limited to 'sys/kern/kern_mac.c')
-rw-r--r--sys/kern/kern_mac.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/kern/kern_mac.c b/sys/kern/kern_mac.c
index 43c03cc..6544f01 100644
--- a/sys/kern/kern_mac.c
+++ b/sys/kern/kern_mac.c
@@ -978,8 +978,9 @@ mac_update_vnode_from_mount(struct vnode *vp, struct mount *mp)
MAC_PERFORM(update_vnode_from_mount, vp, &vp->v_label, mp,
&mp->mnt_fslabel);
+ ASSERT_VOP_LOCKED(vp, "mac_update_vnode_from_mount");
if (mac_cache_fslabel_in_vnode)
- vp->v_flag |= VCACHEDLABEL;
+ vp->v_vflag |= VV_CACHEDLABEL;
}
/*
@@ -1031,7 +1032,7 @@ vop_stdrefreshlabel_ea(struct vop_refreshlabel_args *ap)
if (error == 0)
error = mac_update_vnode_from_externalized(vp, &extmac);
if (error == 0)
- vp->v_flag |= VCACHEDLABEL;
+ vp->v_vflag |= VV_CACHEDLABEL;
else {
struct vattr va;
@@ -1084,7 +1085,7 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred)
return (EBADF);
}
- if (vp->v_flag & VCACHEDLABEL) {
+ if (vp->v_vflag & VV_CACHEDLABEL) {
mac_vnode_label_cache_hits++;
return (0);
} else
@@ -1124,6 +1125,7 @@ vop_stdcreatevnode_ea(struct vnode *dvp, struct vnode *tvp, struct ucred *cred)
struct mac extmac;
int error;
+ ASSERT_VOP_LOCKED(tvp, "vop_stdcreatevnode_ea");
if ((dvp->v_mount->mnt_flag & MNT_MULTILABEL) == 0) {
mac_update_vnode_from_mount(tvp, tvp->v_mount);
} else {
@@ -1156,7 +1158,7 @@ vop_stdcreatevnode_ea(struct vnode *dvp, struct vnode *tvp, struct ucred *cred)
FREEBSD_MAC_EXTATTR_NAMESPACE, FREEBSD_MAC_EXTATTR_NAME,
sizeof(extmac), (char *)&extmac, curthread);
if (error == 0)
- tvp->v_flag |= VCACHEDLABEL;
+ tvp->v_vflag |= VV_CACHEDLABEL;
else {
#if 0
/*
@@ -2771,7 +2773,7 @@ vop_stdsetlabel_ea(struct vop_setlabel_args *ap)
mac_relabel_vnode(ap->a_cred, vp, intlabel);
- vp->v_flag |= VCACHEDLABEL;
+ vp->v_vflag |= VV_CACHEDLABEL;
return (0);
}
OpenPOWER on IntegriCloud