mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +03:00
Illumos #3598
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:
committed by
Brian Behlendorf
parent
7011fb6004
commit
2e528b49f8
+19
-19
@@ -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.
|
||||
*/
|
||||
|
||||
#include <sys/dmu.h>
|
||||
@@ -249,12 +249,12 @@ getcomponent(const char *path, char *component, const char **nextp)
|
||||
char *p;
|
||||
|
||||
if ((path == NULL) || (path[0] == '\0'))
|
||||
return (ENOENT);
|
||||
return (SET_ERROR(ENOENT));
|
||||
/* This would be a good place to reserve some namespace... */
|
||||
p = strpbrk(path, "/@");
|
||||
if (p && (p[1] == '/' || p[1] == '@')) {
|
||||
/* two separators in a row */
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
}
|
||||
if (p == NULL || p == path) {
|
||||
/*
|
||||
@@ -264,14 +264,14 @@ getcomponent(const char *path, char *component, const char **nextp)
|
||||
*/
|
||||
if (p != NULL &&
|
||||
(p[0] != '@' || strpbrk(path+1, "/@") || p[1] == '\0'))
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
if (strlen(path) >= MAXNAMELEN)
|
||||
return (ENAMETOOLONG);
|
||||
return (SET_ERROR(ENAMETOOLONG));
|
||||
(void) strcpy(component, path);
|
||||
p = NULL;
|
||||
} else if (p[0] == '/') {
|
||||
if (p - path >= MAXNAMELEN)
|
||||
return (ENAMETOOLONG);
|
||||
return (SET_ERROR(ENAMETOOLONG));
|
||||
(void) strncpy(component, path, p - path);
|
||||
component[p - path] = '\0';
|
||||
p++;
|
||||
@@ -281,9 +281,9 @@ getcomponent(const char *path, char *component, const char **nextp)
|
||||
* any more slashes.
|
||||
*/
|
||||
if (strchr(path, '/'))
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
if (p - path >= MAXNAMELEN)
|
||||
return (ENAMETOOLONG);
|
||||
return (SET_ERROR(ENAMETOOLONG));
|
||||
(void) strncpy(component, path, p - path);
|
||||
component[p - path] = '\0';
|
||||
} else {
|
||||
@@ -318,7 +318,7 @@ dsl_dir_hold(dsl_pool_t *dp, const char *name, void *tag,
|
||||
/* Make sure the name is in the specified pool. */
|
||||
spaname = spa_name(dp->dp_spa);
|
||||
if (strcmp(buf, spaname) != 0) {
|
||||
err = EINVAL;
|
||||
err = SET_ERROR(EINVAL);
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ dsl_dir_hold(dsl_pool_t *dp, const char *name, void *tag,
|
||||
/* bad path name */
|
||||
dsl_dir_rele(dd, tag);
|
||||
dprintf("next=%p (%s) tail=%p\n", next, next?next:"", tailp);
|
||||
err = ENOENT;
|
||||
err = SET_ERROR(ENOENT);
|
||||
}
|
||||
if (tailp != NULL)
|
||||
*tailp = next;
|
||||
@@ -682,7 +682,7 @@ dsl_dir_tempreserve_impl(dsl_dir_t *dd, uint64_t asize, boolean_t netfree,
|
||||
used_on_disk>>10, est_inflight>>10,
|
||||
quota>>10, asize>>10, retval);
|
||||
mutex_exit(&dd->dd_lock);
|
||||
return (retval);
|
||||
return (SET_ERROR(retval));
|
||||
}
|
||||
|
||||
/* We need to up our estimated delta before dropping dd_lock */
|
||||
@@ -744,7 +744,7 @@ dsl_dir_tempreserve_space(dsl_dir_t *dd, uint64_t lsize, uint64_t asize,
|
||||
} else {
|
||||
if (err == EAGAIN) {
|
||||
txg_delay(dd->dd_pool, tx->tx_txg, 1);
|
||||
err = ERESTART;
|
||||
err = SET_ERROR(ERESTART);
|
||||
}
|
||||
dsl_pool_memory_pressure(dd->dd_pool);
|
||||
}
|
||||
@@ -956,7 +956,7 @@ dsl_dir_set_quota_check(void *arg, dmu_tx_t *tx)
|
||||
if ((dmu_tx_is_syncing(tx) || towrite == 0) &&
|
||||
(newval < ds->ds_dir->dd_phys->dd_reserved ||
|
||||
newval < ds->ds_dir->dd_phys->dd_used_bytes + towrite)) {
|
||||
error = ENOSPC;
|
||||
error = SET_ERROR(ENOSPC);
|
||||
}
|
||||
mutex_exit(&ds->ds_dir->dd_lock);
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
@@ -1050,7 +1050,7 @@ dsl_dir_set_reservation_check(void *arg, dmu_tx_t *tx)
|
||||
if (delta > avail ||
|
||||
(dd->dd_phys->dd_quota > 0 &&
|
||||
newval > dd->dd_phys->dd_quota))
|
||||
error = ENOSPC;
|
||||
error = SET_ERROR(ENOSPC);
|
||||
}
|
||||
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
@@ -1157,7 +1157,7 @@ dsl_valid_rename(dsl_pool_t *dp, dsl_dataset_t *ds, void *arg)
|
||||
dsl_dataset_name(ds, namebuf);
|
||||
|
||||
if (strlen(namebuf) + *deltap >= MAXNAMELEN)
|
||||
return (ENAMETOOLONG);
|
||||
return (SET_ERROR(ENAMETOOLONG));
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -1188,14 +1188,14 @@ dsl_dir_rename_check(void *arg, dmu_tx_t *tx)
|
||||
if (dd->dd_pool != newparent->dd_pool) {
|
||||
dsl_dir_rele(newparent, FTAG);
|
||||
dsl_dir_rele(dd, FTAG);
|
||||
return (ENXIO);
|
||||
return (SET_ERROR(ENXIO));
|
||||
}
|
||||
|
||||
/* new name should not already exist */
|
||||
if (mynewname == NULL) {
|
||||
dsl_dir_rele(newparent, FTAG);
|
||||
dsl_dir_rele(dd, FTAG);
|
||||
return (EEXIST);
|
||||
return (SET_ERROR(EEXIST));
|
||||
}
|
||||
|
||||
/* if the name length is growing, validate child name lengths */
|
||||
@@ -1218,7 +1218,7 @@ dsl_dir_rename_check(void *arg, dmu_tx_t *tx)
|
||||
if (closest_common_ancestor(dd, newparent) == dd) {
|
||||
dsl_dir_rele(newparent, FTAG);
|
||||
dsl_dir_rele(dd, FTAG);
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
}
|
||||
|
||||
error = dsl_dir_transfer_possible(dd->dd_parent,
|
||||
@@ -1320,7 +1320,7 @@ dsl_dir_transfer_possible(dsl_dir_t *sdd, dsl_dir_t *tdd, uint64_t space)
|
||||
adelta = would_change(sdd, -space, ancestor);
|
||||
avail = dsl_dir_space_available(tdd, ancestor, adelta, FALSE);
|
||||
if (avail < space)
|
||||
return (ENOSPC);
|
||||
return (SET_ERROR(ENOSPC));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user