diff options
author | Matthew Ahrens <[email protected]> | 2013-03-08 10:41:28 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-10-31 14:58:04 -0700 |
commit | 2e528b49f8a0f8f2f51536a00fdf3ea9343bf302 (patch) | |
tree | 5c7c906ca4a8a6f52d6aafbf4eddefc8e872e42f /module/zfs/zfs_acl.c | |
parent | 7011fb6004b2227ff9e89894ed69ab83d36c1696 (diff) |
Illumos #3598
3598 want to dtrace when errors are generated in zfs
Reviewed by: Dan Kimmel <[email protected]>
Reviewed by: Adam Leventhal <[email protected]>
Reviewed by: Christopher Siden <[email protected]>
Approved by: Garrett D'Amore <[email protected]>
References:
https://www.illumos.org/issues/3598
illumos/illumos-gate@be6fd75a69ae679453d9cda5bff3326111e6d1ca
Ported-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #1775
Porting notes:
1. include/sys/zfs_context.h has been modified to render some new
macros inert until dtrace is available on Linux.
2. Linux-specific changes have been adapted to use SET_ERROR().
3. I'm NOT happy about this change. It does nothing but ugly
up the code under Linux. Unfortunately we need to take it to
avoid more merge conflicts in the future. -Brian
Diffstat (limited to 'module/zfs/zfs_acl.c')
-rw-r--r-- | module/zfs/zfs_acl.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/module/zfs/zfs_acl.c b/module/zfs/zfs_acl.c index 25f236a14..311b19942 100644 --- a/module/zfs/zfs_acl.c +++ b/module/zfs/zfs_acl.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ @@ -676,7 +677,7 @@ zfs_copy_ace_2_fuid(zfs_sb_t *zsb, umode_t obj_mode, zfs_acl_t *aclp, */ if (zfs_ace_valid(obj_mode, aclp, aceptr->z_hdr.z_type, aceptr->z_hdr.z_flags) != B_TRUE) - return (EINVAL); + return (SET_ERROR(EINVAL)); switch (acep->a_type) { case ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE: @@ -783,7 +784,7 @@ zfs_copy_ace_2_oldace(umode_t obj_mode, zfs_acl_t *aclp, ace_t *acep, */ if (zfs_ace_valid(obj_mode, aclp, aceptr->z_type, aceptr->z_flags) != B_TRUE) - return (EINVAL); + return (SET_ERROR(EINVAL)); } *size = (caddr_t)aceptr - (caddr_t)z_acl; return (0); @@ -1117,7 +1118,7 @@ zfs_acl_node_read(znode_t *zp, boolean_t have_lock, zfs_acl_t **aclpp, zfs_acl_node_free(aclnode); /* convert checksum errors into IO errors */ if (error == ECKSUM) - error = EIO; + error = SET_ERROR(EIO); goto done; } @@ -1887,7 +1888,7 @@ zfs_getacl(znode_t *zp, vsecattr_t *vsecp, boolean_t skipaclchk, cred_t *cr) VSA_ACE_ACLFLAGS | VSA_ACE_ALLTYPES); if (mask == 0) - return (ENOSYS); + return (SET_ERROR(ENOSYS)); if ((error = zfs_zaccess(zp, ACE_READ_ACL, 0, skipaclchk, cr))) return (error); @@ -1981,7 +1982,7 @@ zfs_vsec_2_aclp(zfs_sb_t *zsb, umode_t obj_mode, int error; if (vsecp->vsa_aclcnt > MAX_ACL_ENTRIES || vsecp->vsa_aclcnt <= 0) - return (EINVAL); + return (SET_ERROR(EINVAL)); aclp = zfs_acl_alloc(zfs_acl_version(zsb->z_version)); @@ -2043,10 +2044,10 @@ zfs_setacl(znode_t *zp, vsecattr_t *vsecp, boolean_t skipaclchk, cred_t *cr) uint64_t acl_obj; if (mask == 0) - return (ENOSYS); + return (SET_ERROR(ENOSYS)); if (zp->z_pflags & ZFS_IMMUTABLE) - return (EPERM); + return (SET_ERROR(EPERM)); if ((error = zfs_zaccess(zp, ACE_WRITE_ACL, 0, skipaclchk, cr))) return (error); @@ -2142,7 +2143,7 @@ zfs_zaccess_dataset_check(znode_t *zp, uint32_t v4_mode) if ((v4_mode & WRITE_MASK) && (zfs_is_readonly(ZTOZSB(zp))) && (!S_ISDEV(ZTOI(zp)->i_mode) || (S_ISDEV(ZTOI(zp)->i_mode) && (v4_mode & WRITE_MASK_ATTRS)))) { - return (EROFS); + return (SET_ERROR(EROFS)); } /* @@ -2153,17 +2154,17 @@ zfs_zaccess_dataset_check(znode_t *zp, uint32_t v4_mode) (zp->z_pflags & (ZFS_READONLY | ZFS_IMMUTABLE))) || (S_ISDIR(ZTOI(zp)->i_mode) && (zp->z_pflags & ZFS_IMMUTABLE)))) { - return (EPERM); + return (SET_ERROR(EPERM)); } if ((v4_mode & (ACE_DELETE | ACE_DELETE_CHILD)) && (zp->z_pflags & ZFS_NOUNLINK)) { - return (EPERM); + return (SET_ERROR(EPERM)); } if (((v4_mode & (ACE_READ_DATA|ACE_EXECUTE)) && (zp->z_pflags & ZFS_AV_QUARANTINED))) { - return (EACCES); + return (SET_ERROR(EACCES)); } return (0); @@ -2272,7 +2273,7 @@ zfs_zaccess_aces_check(znode_t *zp, uint32_t *working_mode, break; } else { mutex_exit(&zp->z_acl_lock); - return (EIO); + return (SET_ERROR(EIO)); } } @@ -2306,7 +2307,7 @@ zfs_zaccess_aces_check(znode_t *zp, uint32_t *working_mode, /* Put the found 'denies' back on the working mode */ if (deny_mask) { *working_mode |= deny_mask; - return (EACCES); + return (SET_ERROR(EACCES)); } else if (*working_mode) { return (-1); } @@ -2373,7 +2374,7 @@ zfs_zaccess_append(znode_t *zp, uint32_t *working_mode, boolean_t *check_privs, cred_t *cr) { if (*working_mode != ACE_WRITE_DATA) - return (EACCES); + return (SET_ERROR(EACCES)); return (zfs_zaccess_common(zp, ACE_APPEND_DATA, working_mode, check_privs, B_FALSE, cr)); @@ -2389,7 +2390,7 @@ zfs_fastaccesschk_execute(znode_t *zdp, cred_t *cr) int error; if (zdp->z_pflags & ZFS_AV_QUARANTINED) - return (EACCES); + return (SET_ERROR(EACCES)); is_attr = ((zdp->z_pflags & ZFS_XATTR) && (S_ISDIR(ZTOI(zdp)->i_mode))); @@ -2601,7 +2602,7 @@ zfs_zaccess(znode_t *zp, int mode, int flags, boolean_t skipaclchk, cred_t *cr) * for are still present. If so then return EACCES */ if (working_mode & ~(ZFS_CHECKED_MASKS)) { - error = EACCES; + error = SET_ERROR(EACCES); } } } else if (error == 0) { @@ -2711,7 +2712,7 @@ zfs_zaccess_delete(znode_t *dzp, znode_t *zp, cred_t *cr) */ if (zp->z_pflags & (ZFS_IMMUTABLE | ZFS_NOUNLINK)) - return (EPERM); + return (SET_ERROR(EPERM)); /* * First row @@ -2778,7 +2779,7 @@ zfs_zaccess_rename(znode_t *sdzp, znode_t *szp, znode_t *tdzp, int error; if (szp->z_pflags & ZFS_AV_QUARANTINED) - return (EACCES); + return (SET_ERROR(EACCES)); add_perm = S_ISDIR(ZTOI(szp)->i_mode) ? ACE_ADD_SUBDIRECTORY : ACE_ADD_FILE; |