PERFORCE change 170207 for review
Edward Tomasz Napierala
trasz at FreeBSD.org
Thu Nov 5 00:57:54 UTC 2009
http://p4web.freebsd.org/chv.cgi?CH=170207
Change 170207 by trasz at trasz_victim on 2009/11/05 00:57:37
Be rational. Instead of inventing two different semantics for VAPPEND,
just stick to the notion that VAPPEND is just a modifier for VWRITE.
Add a few KASSERTs to make sure this is the case.
Affected files ...
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_ACCESS.9#10 edit
.. //depot/projects/soc2008/trasz_nfs4acl/sys/kern/subr_acl_nfs4.c#52 edit
.. //depot/projects/soc2008/trasz_nfs4acl/sys/kern/subr_acl_posix1e.c#18 edit
.. //depot/projects/soc2008/trasz_nfs4acl/sys/kern/vfs_subr.c#42 edit
.. //depot/projects/soc2008/trasz_nfs4acl/sys/ufs/ufs/ufs_lookup.c#19 edit
Differences ...
==== //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_ACCESS.9#10 (text+ko) ====
@@ -80,6 +80,13 @@
To check for other flags, one has to use
.Fn VOP_ACCESSX
instead.
+.Pp
+The
+.Dv VAPPEND
+flag may only be set if
+.Dv
+VWRITE
+flag is set.
.Sh LOCKS
The vnode will be locked on entry and should remain locked on return.
.Sh RETURN VALUES
==== //depot/projects/soc2008/trasz_nfs4acl/sys/kern/subr_acl_nfs4.c#52 (text+ko) ====
@@ -82,6 +82,13 @@
access_mask |= accmode2mask[i].mask;
}
+ /*
+ * VAPPEND is just a modifier for VWRITE; if the caller asked
+ * for 'VAPPEND | VWRITE', we want to check for ACL_APPEND_DATA only.
+ */
+ if (access_mask & ACL_APPEND_DATA)
+ access_mask &= ~ACL_WRITE_DATA;
+
return (access_mask);
}
@@ -156,6 +163,9 @@
int denied, explicitly_denied, access_mask, is_directory,
must_be_owner = 0;
+ KASSERT((accmode & VAPPEND) == 0 || (accmode & VWRITE),
+ ("VAPPEND without VWRITE"));
+
if (privused != NULL)
*privused = 0;
==== //depot/projects/soc2008/trasz_nfs4acl/sys/kern/subr_acl_posix1e.c#18 (text+ko) ====
@@ -63,6 +63,8 @@
KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0,
("invalid bit in accmode"));
+ KASSERT((accmode & VAPPEND) == 0 || (accmode & VWRITE),
+ ("VAPPEND without VWRITE"));
/*
* Look for a normal, non-privileged way to access the file/directory
==== //depot/projects/soc2008/trasz_nfs4acl/sys/kern/vfs_subr.c#42 (text+ko) ====
@@ -3522,6 +3522,8 @@
KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0,
("invalid bit in accmode"));
+ KASSERT((accmode & VAPPEND) == 0 || (accmode & VWRITE),
+ ("VAPPEND without VWRITE"));
/*
* Look for a normal, non-privileged way to access the file/directory
==== //depot/projects/soc2008/trasz_nfs4acl/sys/ufs/ufs/ufs_lookup.c#19 (text+ko) ====
@@ -469,7 +469,7 @@
* XXX: Fix the comment above.
*/
if (flags & WILLBEDIR)
- error = VOP_ACCESSX(vdp, VAPPEND, cred, cnp->cn_thread);
+ error = VOP_ACCESSX(vdp, VWRITE | VAPPEND, cred, cnp->cn_thread);
else
error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread);
if (error)
@@ -604,7 +604,7 @@
*/
if (nameiop == RENAME && (flags & ISLASTCN)) {
if (flags & WILLBEDIR)
- error = VOP_ACCESSX(vdp, VAPPEND, cred, cnp->cn_thread);
+ error = VOP_ACCESSX(vdp, VWRITE | VAPPEND, cred, cnp->cn_thread);
else
error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread);
if (error)
@@ -637,7 +637,7 @@
* of EACCESS.
*/
if (tdp->v_type == VDIR)
- error = VOP_ACCESSX(vdp, VAPPEND, cred, cnp->cn_thread);
+ error = VOP_ACCESSX(vdp, VWRITE | VAPPEND, cred, cnp->cn_thread);
else
error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread);
if (error) {
More information about the p4-projects
mailing list