MFC r196949:

Enable NFSv4 ACL support in ZFS.

MFC r197435:

In VOP_SETACL(9) and VOP_GETACL(9), specifying wrong ACL type should result
in EINVAL, not EOPNOTSUPP.
This commit is contained in:
Edward Tomasz Napierala 2010-01-31 02:11:14 +00:00
parent f4d24e0ea3
commit 7782c5efe8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/8/; revision=203264

View File

@ -3851,7 +3851,15 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr,
#endif
case _PC_ACL_EXTENDED:
*valp = 0; /* TODO */
*valp = 0;
return (0);
case _PC_ACL_NFS4:
*valp = 1;
return (0);
case _PC_ACL_PATH_MAX:
*valp = ACL_MAX_ENTRIES;
return (0);
case _PC_MIN_HOLE_SIZE:
@ -4471,6 +4479,26 @@ zfs_freebsd_pathconf(ap)
return (error);
}
static int
zfs_freebsd_fifo_pathconf(ap)
struct vop_pathconf_args /* {
struct vnode *a_vp;
int a_name;
register_t *a_retval;
} */ *ap;
{
switch (ap->a_name) {
case _PC_ACL_EXTENDED:
case _PC_ACL_NFS4:
case _PC_ACL_PATH_MAX:
case _PC_MAC_PRESENT:
return (zfs_freebsd_pathconf(ap));
default:
return (fifo_specops.vop_pathconf(ap));
}
}
/*
* FreeBSD's extended attributes namespace defines file name prefix for ZFS'
* extended attribute name:
@ -4865,7 +4893,7 @@ zfs_freebsd_getacl(ap)
vsecattr_t vsecattr;
if (ap->a_type != ACL_TYPE_NFS4)
return (EOPNOTSUPP);
return (EINVAL);
vsecattr.vsa_mask = VSA_ACE | VSA_ACECNT;
if (error = zfs_getsecattr(ap->a_vp, &vsecattr, 0, ap->a_cred, NULL))
@ -4894,13 +4922,13 @@ zfs_freebsd_setacl(ap)
aclent_t *aaclp;
if (ap->a_type != ACL_TYPE_NFS4)
return (EOPNOTSUPP);
return (EINVAL);
if (ap->a_aclp->acl_cnt < 1 || ap->a_aclp->acl_cnt > MAX_ACL_ENTRIES)
return (EINVAL);
/*
* With NFS4 ACLs, chmod(2) may need to add additional entries,
* With NFSv4 ACLs, chmod(2) may need to add additional entries,
* splitting every entry into two and appending "canonical six"
* entries at the end. Don't allow for setting an ACL that would
* cause chmod(2) to run out of ACL entries.
@ -4974,11 +5002,9 @@ struct vop_vector zfs_vnodeops = {
.vop_deleteextattr = zfs_deleteextattr,
.vop_setextattr = zfs_setextattr,
.vop_listextattr = zfs_listextattr,
#ifdef notyet
.vop_getacl = zfs_freebsd_getacl,
.vop_setacl = zfs_freebsd_setacl,
.vop_aclcheck = zfs_freebsd_aclcheck,
#endif
};
struct vop_vector zfs_fifoops = {
@ -4991,10 +5017,9 @@ struct vop_vector zfs_fifoops = {
.vop_reclaim = zfs_freebsd_reclaim,
.vop_setattr = zfs_freebsd_setattr,
.vop_write = VOP_PANIC,
.vop_pathconf = zfs_freebsd_fifo_pathconf,
.vop_fid = zfs_freebsd_fid,
#ifdef notyet
.vop_getacl = zfs_freebsd_getacl,
.vop_setacl = zfs_freebsd_setacl,
.vop_aclcheck = zfs_freebsd_aclcheck,
#endif
};