Date: Fri, 30 Oct 2009 23:33:06 +0000 (UTC) From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r198703 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/sys Message-ID: <200910302333.n9UNX6BX061974@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pjd Date: Fri Oct 30 23:33:06 2009 New Revision: 198703 URL: http://svn.freebsd.org/changeset/base/198703 Log: - 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 Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/vnode.h Fri Oct 30 21:54:53 2009 (r198702) +++ head/sys/cddl/compat/opensolaris/sys/vnode.h Fri Oct 30 23:33:06 2009 (r198703) @@ -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) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Oct 30 21:54:53 2009 (r198702) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Oct 30 23:33:06 2009 (r198703) @@ -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 Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h Fri Oct 30 21:54:53 2009 (r198702) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h Fri Oct 30 23:33:06 2009 (r198703) @@ -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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910302333.n9UNX6BX061974>