3598 want to dtrace when errors are generated in zfs
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Approved by: Garrett D'Amore <garrett@damore.org>

References:
  https://www.illumos.org/issues/3598
  illumos/illumos-gate@be6fd75a69

Ported-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
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
This commit is contained in:
Matthew Ahrens
2013-03-08 10:41:28 -08:00
committed by Brian Behlendorf
parent 7011fb6004
commit 2e528b49f8
56 changed files with 830 additions and 793 deletions
+21 -21
View File
@@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
/* Portions Copyright 2010 Robert Milkowski */
@@ -344,7 +344,7 @@ zfs_space_delta_cb(dmu_object_type_t bonustype, void *data,
* Is it a valid type of object to track?
*/
if (bonustype != DMU_OT_ZNODE && bonustype != DMU_OT_SA)
return (ENOENT);
return (SET_ERROR(ENOENT));
/*
* If we have a NULL data pointer
@@ -353,7 +353,7 @@ zfs_space_delta_cb(dmu_object_type_t bonustype, void *data,
* use the same ids
*/
if (data == NULL)
return (EEXIST);
return (SET_ERROR(EEXIST));
if (bonustype == DMU_OT_ZNODE) {
znode_phys_t *znp = data;
@@ -429,7 +429,7 @@ zfs_userquota_prop_to_obj(zfs_sb_t *zsb, zfs_userquota_prop_t type)
case ZFS_PROP_GROUPQUOTA:
return (zsb->z_groupquota_obj);
default:
return (ENOTSUP);
return (SET_ERROR(ENOTSUP));
}
return (0);
}
@@ -445,7 +445,7 @@ zfs_userspace_many(zfs_sb_t *zsb, zfs_userquota_prop_t type,
uint64_t obj;
if (!dmu_objset_userspace_present(zsb->z_os))
return (ENOTSUP);
return (SET_ERROR(ENOTSUP));
obj = zfs_userquota_prop_to_obj(zsb, type);
if (obj == 0) {
@@ -490,7 +490,7 @@ id_to_fuidstr(zfs_sb_t *zsb, const char *domain, uid_t rid,
if (domain && domain[0]) {
domainid = zfs_fuid_find_by_domain(zsb, domain, NULL, addok);
if (domainid == -1)
return (ENOENT);
return (SET_ERROR(ENOENT));
}
fuid = FUID_ENCODE(domainid, rid);
(void) sprintf(buf, "%llx", (longlong_t)fuid);
@@ -508,7 +508,7 @@ zfs_userspace_one(zfs_sb_t *zsb, zfs_userquota_prop_t type,
*valp = 0;
if (!dmu_objset_userspace_present(zsb->z_os))
return (ENOTSUP);
return (SET_ERROR(ENOTSUP));
obj = zfs_userquota_prop_to_obj(zsb, type);
if (obj == 0)
@@ -536,10 +536,10 @@ zfs_set_userquota(zfs_sb_t *zsb, zfs_userquota_prop_t type,
boolean_t fuid_dirtied;
if (type != ZFS_PROP_USERQUOTA && type != ZFS_PROP_GROUPQUOTA)
return (EINVAL);
return (SET_ERROR(EINVAL));
if (zsb->z_version < ZPL_VERSION_USERSPACE)
return (ENOTSUP);
return (SET_ERROR(ENOTSUP));
objp = (type == ZFS_PROP_USERQUOTA) ? &zsb->z_userquota_obj :
&zsb->z_groupquota_obj;
@@ -670,7 +670,7 @@ zfs_sb_create(const char *osname, zfs_sb_t **zsbp)
"on a version %lld pool\n. Pool must be upgraded to mount "
"this file system.", (u_longlong_t)zsb->z_version,
(u_longlong_t)spa_version(dmu_objset_spa(os)));
error = ENOTSUP;
error = SET_ERROR(ENOTSUP);
goto out;
}
if ((error = zfs_get_zplprop(os, ZFS_PROP_NORMALIZE, &zval)) != 0)
@@ -968,10 +968,10 @@ zfs_check_global_label(const char *dsname, const char *hexsl)
if (dsl_prop_get_integer(dsname,
zfs_prop_to_name(ZFS_PROP_READONLY), &rdonly, NULL))
return (EACCES);
return (SET_ERROR(EACCES));
return (rdonly ? 0 : EACCES);
}
return (EACCES);
return (SET_ERROR(EACCES));
}
EXPORT_SYMBOL(zfs_check_global_label);
#endif /* HAVE_MLSLABEL */
@@ -1127,7 +1127,7 @@ zfs_sb_teardown(zfs_sb_t *zsb, boolean_t unmounting)
if (!unmounting && (zsb->z_unmounted || zsb->z_os == NULL)) {
rw_exit(&zsb->z_teardown_inactive_lock);
rrw_exit(&zsb->z_teardown_lock, FTAG);
return (EIO);
return (SET_ERROR(EIO));
}
/*
@@ -1274,7 +1274,7 @@ zfs_domount(struct super_block *sb, void *data, int silent)
sb->s_root = d_make_root(root_inode);
if (sb->s_root == NULL) {
(void) zfs_umount(sb);
error = ENOMEM;
error = SET_ERROR(ENOMEM);
goto out;
}
@@ -1389,7 +1389,7 @@ zfs_vget(struct super_block *sb, struct inode **ipp, fid_t *fidp)
err = zfsctl_lookup_objset(sb, objsetid, &zsb);
if (err)
return (EINVAL);
return (SET_ERROR(EINVAL));
ZFS_ENTER(zsb);
}
@@ -1404,7 +1404,7 @@ zfs_vget(struct super_block *sb, struct inode **ipp, fid_t *fidp)
fid_gen |= ((uint64_t)zfid->zf_gen[i]) << (8 * i);
} else {
ZFS_EXIT(zsb);
return (EINVAL);
return (SET_ERROR(EINVAL));
}
/* A zero fid_gen means we are in the .zfs control directories */
@@ -1438,7 +1438,7 @@ zfs_vget(struct super_block *sb, struct inode **ipp, fid_t *fidp)
dprintf("znode gen (%u) != fid gen (%u)\n", zp_gen, fid_gen);
iput(ZTOI(zp));
ZFS_EXIT(zsb);
return (EINVAL);
return (SET_ERROR(EINVAL));
}
*ipp = ZTOI(zp);
@@ -1548,14 +1548,14 @@ zfs_set_version(zfs_sb_t *zsb, uint64_t newvers)
dmu_tx_t *tx;
if (newvers < ZPL_VERSION_INITIAL || newvers > ZPL_VERSION)
return (EINVAL);
return (SET_ERROR(EINVAL));
if (newvers < zsb->z_version)
return (EINVAL);
return (SET_ERROR(EINVAL));
if (zfs_spa_version_map(newvers) >
spa_version(dmu_objset_spa(zsb->z_os)))
return (ENOTSUP);
return (SET_ERROR(ENOTSUP));
tx = dmu_tx_create(os);
dmu_tx_hold_zap(tx, MASTER_NODE_OBJ, B_FALSE, ZPL_VERSION_STR);
@@ -1615,7 +1615,7 @@ int
zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value)
{
const char *pname;
int error = ENOENT;
int error = SET_ERROR(ENOENT);
/*
* Look up the file system's value for the property. For the