- zfs_zaccess() can handle VAPPEND too, so map V_APPEND to VAPPEND and call

zfs_access() instead of vaccess() in this case as well.
- If VADMIN is specified with another V* flag (unlikely) call both
  zfs_access() and vaccess() after spliting V* flags.

This fixes "dirtying snapshot!" panic.

PR:		kern/139806
Reported by:	Carl Chave <carl@chave.us>
In co-operation with:	jh
MFC after:	3 days
This commit is contained in:
pjd 2009-10-30 23:33:06 +00:00
parent 1f53d34702
commit aad7199531
3 changed files with 23 additions and 10 deletions

View File

@ -57,6 +57,8 @@ typedef struct vop_vector vnodeops_t;
#define v_count v_usecount
#define V_APPEND VAPPEND
static __inline int
vn_is_readonly(vnode_t *vp)
{

View File

@ -3989,21 +3989,33 @@ zfs_freebsd_access(ap)
struct thread *a_td;
} */ *ap;
{
accmode_t accmode;
int error = 0;
/*
* ZFS itself only knowns about VREAD, VWRITE and VEXEC, the rest
* we have to handle by calling vaccess().
* ZFS itself only knowns about VREAD, VWRITE, VEXEC and VAPPEND,
*/
if ((ap->a_accmode & ~(VREAD|VWRITE|VEXEC)) != 0) {
vnode_t *vp = ap->a_vp;
znode_t *zp = VTOZ(vp);
znode_phys_t *zphys = zp->z_phys;
accmode = ap->a_accmode & (VREAD|VWRITE|VEXEC|VAPPEND);
if (accmode != 0)
error = zfs_access(ap->a_vp, accmode, 0, ap->a_cred, NULL);
return (vaccess(vp->v_type, zphys->zp_mode, zphys->zp_uid,
zphys->zp_gid, ap->a_accmode, ap->a_cred, NULL));
/*
* VADMIN has to be handled by vaccess().
*/
if (error == 0) {
accmode = ap->a_accmode & ~(VREAD|VWRITE|VEXEC|VAPPEND);
if (accmode != 0) {
vnode_t *vp = ap->a_vp;
znode_t *zp = VTOZ(vp);
znode_phys_t *zphys = zp->z_phys;
error = vaccess(vp->v_type, zphys->zp_mode,
zphys->zp_uid, zphys->zp_gid, accmode, ap->a_cred,
NULL);
}
}
return (zfs_access(ap->a_vp, ap->a_accmode, 0, ap->a_cred, NULL));
return (error);
}
static int

View File

@ -304,7 +304,6 @@ typedef struct xvattr {
* VOP_ACCESS flags
*/
#define V_ACE_MASK 0x1 /* mask represents NFSv4 ACE permissions */
#define V_APPEND 0x2 /* want to do append only check */
/*
* Flags for vnode operations.