summaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_dir.c
diff options
context:
space:
mode:
authorMatthew Ahrens <[email protected]>2013-03-08 10:41:28 -0800
committerBrian Behlendorf <[email protected]>2013-10-31 14:58:04 -0700
commit2e528b49f8a0f8f2f51536a00fdf3ea9343bf302 (patch)
tree5c7c906ca4a8a6f52d6aafbf4eddefc8e872e42f /module/zfs/zfs_dir.c
parent7011fb6004b2227ff9e89894ed69ab83d36c1696 (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_dir.c')
-rw-r--r--module/zfs/zfs_dir.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/module/zfs/zfs_dir.c b/module/zfs/zfs_dir.c
index 4a4969f1c..17c77d035 100644
--- a/module/zfs/zfs_dir.c
+++ b/module/zfs/zfs_dir.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.
*/
@@ -171,7 +172,7 @@ zfs_dirent_lock(zfs_dirlock_t **dlpp, znode_t *dzp, char *name, znode_t **zpp,
if ((name[0] == '.' &&
(name[1] == '\0' || (name[1] == '.' && name[2] == '\0'))) ||
(zfs_has_ctldir(dzp) && strcmp(name, ZFS_CTLDIR_NAME) == 0))
- return (EEXIST);
+ return (SET_ERROR(EEXIST));
/*
* Case sensitivity and normalization preferences are set when
@@ -242,7 +243,7 @@ zfs_dirent_lock(zfs_dirlock_t **dlpp, znode_t *dzp, char *name, znode_t **zpp,
mutex_exit(&dzp->z_lock);
if (!(flag & ZHAVELOCK))
rw_exit(&dzp->z_name_lock);
- return (ENOENT);
+ return (SET_ERROR(ENOENT));
}
for (dl = dzp->z_dirlocks; dl != NULL; dl = dl->dl_next) {
if ((u8_strcmp(name, dl->dl_name, 0, cmpflags,
@@ -253,7 +254,7 @@ zfs_dirent_lock(zfs_dirlock_t **dlpp, znode_t *dzp, char *name, znode_t **zpp,
mutex_exit(&dzp->z_lock);
if (!(flag & ZHAVELOCK))
rw_exit(&dzp->z_name_lock);
- return (ENOENT);
+ return (SET_ERROR(ENOENT));
}
if (dl == NULL) {
/*
@@ -307,19 +308,19 @@ zfs_dirent_lock(zfs_dirlock_t **dlpp, znode_t *dzp, char *name, znode_t **zpp,
error = sa_lookup(dzp->z_sa_hdl, SA_ZPL_XATTR(zsb), &zoid,
sizeof (zoid));
if (error == 0)
- error = (zoid == 0 ? ENOENT : 0);
+ error = (zoid == 0 ? SET_ERROR(ENOENT) : 0);
} else {
#ifdef HAVE_DNLC
if (update)
vp = dnlc_lookup(ZTOI(dzp), name);
if (vp == DNLC_NO_VNODE) {
iput(vp);
- error = ENOENT;
+ error = SET_ERROR(ENOENT);
} else if (vp) {
if (flag & ZNEW) {
zfs_dirent_unlock(dl);
iput(vp);
- return (EEXIST);
+ return (SET_ERROR(EEXIST));
}
*dlpp = dl;
*zpp = VTOZ(vp);
@@ -341,7 +342,7 @@ zfs_dirent_lock(zfs_dirlock_t **dlpp, znode_t *dzp, char *name, znode_t **zpp,
} else {
if (flag & ZNEW) {
zfs_dirent_unlock(dl);
- return (EEXIST);
+ return (SET_ERROR(EEXIST));
}
error = zfs_zget(zsb, zoid, zpp);
if (error) {
@@ -762,7 +763,7 @@ zfs_link_create(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag)
if (zp->z_unlinked) { /* no new links to unlinked zp */
ASSERT(!(flag & (ZNEW | ZEXISTS)));
mutex_exit(&zp->z_lock);
- return (ENOENT);
+ return (SET_ERROR(ENOENT));
}
zp->z_links++;
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_LINKS(zsb), NULL,
@@ -865,7 +866,7 @@ zfs_link_destroy(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag,
if (zp_is_dir && !zfs_dirempty(zp)) {
mutex_exit(&zp->z_lock);
- return (ENOTEMPTY);
+ return (SET_ERROR(ENOTEMPTY));
}
/*
@@ -969,7 +970,7 @@ zfs_make_xattrdir(znode_t *zp, vattr_t *vap, struct inode **xipp, cred_t *cr)
return (error);
if (zfs_acl_ids_overquota(zsb, &acl_ids)) {
zfs_acl_ids_free(&acl_ids);
- return (EDQUOT);
+ return (SET_ERROR(EDQUOT));
}
top:
@@ -1051,12 +1052,12 @@ top:
if (!(flags & CREATE_XATTR_DIR)) {
zfs_dirent_unlock(dl);
- return (ENOENT);
+ return (SET_ERROR(ENOENT));
}
if (zfs_is_readonly(zsb)) {
zfs_dirent_unlock(dl);
- return (EROFS);
+ return (SET_ERROR(EROFS));
}
/*