mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 11:18:52 +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
+23
-23
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/* Portions Copyright 2010 Robert Milkowski */
|
||||
@@ -288,7 +288,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp,
|
||||
kmem_free(os, sizeof (objset_t));
|
||||
/* convert checksum errors into IO errors */
|
||||
if (err == ECKSUM)
|
||||
err = EIO;
|
||||
err = SET_ERROR(EIO);
|
||||
return (err);
|
||||
}
|
||||
|
||||
@@ -501,10 +501,10 @@ dmu_objset_own(const char *name, dmu_objset_type_t type,
|
||||
dsl_dataset_disown(ds, tag);
|
||||
} else if (type != DMU_OST_ANY && type != (*osp)->os_phys->os_type) {
|
||||
dsl_dataset_disown(ds, tag);
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
} else if (!readonly && dsl_dataset_is_snapshot(ds)) {
|
||||
dsl_dataset_disown(ds, tag);
|
||||
return (EROFS);
|
||||
return (SET_ERROR(EROFS));
|
||||
}
|
||||
return (err);
|
||||
}
|
||||
@@ -719,14 +719,14 @@ dmu_objset_create_check(void *arg, dmu_tx_t *tx)
|
||||
int error;
|
||||
|
||||
if (strchr(doca->doca_name, '@') != NULL)
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
|
||||
error = dsl_dir_hold(dp, doca->doca_name, FTAG, &pdd, &tail);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
if (tail == NULL) {
|
||||
dsl_dir_rele(pdd, FTAG);
|
||||
return (EEXIST);
|
||||
return (SET_ERROR(EEXIST));
|
||||
}
|
||||
dsl_dir_rele(pdd, FTAG);
|
||||
|
||||
@@ -800,19 +800,19 @@ dmu_objset_clone_check(void *arg, dmu_tx_t *tx)
|
||||
dsl_pool_t *dp = dmu_tx_pool(tx);
|
||||
|
||||
if (strchr(doca->doca_clone, '@') != NULL)
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
|
||||
error = dsl_dir_hold(dp, doca->doca_clone, FTAG, &pdd, &tail);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
if (tail == NULL) {
|
||||
dsl_dir_rele(pdd, FTAG);
|
||||
return (EEXIST);
|
||||
return (SET_ERROR(EEXIST));
|
||||
}
|
||||
/* You can't clone across pools. */
|
||||
if (pdd->dd_pool != dp) {
|
||||
dsl_dir_rele(pdd, FTAG);
|
||||
return (EXDEV);
|
||||
return (SET_ERROR(EXDEV));
|
||||
}
|
||||
dsl_dir_rele(pdd, FTAG);
|
||||
|
||||
@@ -823,13 +823,13 @@ dmu_objset_clone_check(void *arg, dmu_tx_t *tx)
|
||||
/* You can't clone across pools. */
|
||||
if (origin->ds_dir->dd_pool != dp) {
|
||||
dsl_dataset_rele(origin, FTAG);
|
||||
return (EXDEV);
|
||||
return (SET_ERROR(EXDEV));
|
||||
}
|
||||
|
||||
/* You can only clone snapshots, not the head datasets. */
|
||||
if (!dsl_dataset_is_snapshot(origin)) {
|
||||
dsl_dataset_rele(origin, FTAG);
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
}
|
||||
dsl_dataset_rele(origin, FTAG);
|
||||
|
||||
@@ -1310,9 +1310,9 @@ dmu_objset_userspace_upgrade(objset_t *os)
|
||||
if (dmu_objset_userspace_present(os))
|
||||
return (0);
|
||||
if (!dmu_objset_userused_enabled(os))
|
||||
return (ENOTSUP);
|
||||
return (SET_ERROR(ENOTSUP));
|
||||
if (dmu_objset_is_snapshot(os))
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
|
||||
/*
|
||||
* We simply need to mark every object dirty, so that it will be
|
||||
@@ -1328,7 +1328,7 @@ dmu_objset_userspace_upgrade(objset_t *os)
|
||||
int objerr;
|
||||
|
||||
if (issig(JUSTLOOKING) && issig(FORREAL))
|
||||
return (EINTR);
|
||||
return (SET_ERROR(EINTR));
|
||||
|
||||
objerr = dmu_bonus_hold(os, obj, FTAG, &db);
|
||||
if (objerr != 0)
|
||||
@@ -1404,7 +1404,7 @@ dmu_snapshot_realname(objset_t *os, char *name, char *real, int maxlen,
|
||||
uint64_t ignored;
|
||||
|
||||
if (ds->ds_phys->ds_snapnames_zapobj == 0)
|
||||
return (ENOENT);
|
||||
return (SET_ERROR(ENOENT));
|
||||
|
||||
return (zap_lookup_norm(ds->ds_dir->dd_pool->dp_meta_objset,
|
||||
ds->ds_phys->ds_snapnames_zapobj, name, 8, 1, &ignored, MT_FIRST,
|
||||
@@ -1422,7 +1422,7 @@ dmu_snapshot_list_next(objset_t *os, int namelen, char *name,
|
||||
ASSERT(dsl_pool_config_held(dmu_objset_pool(os)));
|
||||
|
||||
if (ds->ds_phys->ds_snapnames_zapobj == 0)
|
||||
return (ENOENT);
|
||||
return (SET_ERROR(ENOENT));
|
||||
|
||||
zap_cursor_init_serialized(&cursor,
|
||||
ds->ds_dir->dd_pool->dp_meta_objset,
|
||||
@@ -1430,12 +1430,12 @@ dmu_snapshot_list_next(objset_t *os, int namelen, char *name,
|
||||
|
||||
if (zap_cursor_retrieve(&cursor, &attr) != 0) {
|
||||
zap_cursor_fini(&cursor);
|
||||
return (ENOENT);
|
||||
return (SET_ERROR(ENOENT));
|
||||
}
|
||||
|
||||
if (strlen(attr.za_name) + 1 > namelen) {
|
||||
zap_cursor_fini(&cursor);
|
||||
return (ENAMETOOLONG);
|
||||
return (SET_ERROR(ENAMETOOLONG));
|
||||
}
|
||||
|
||||
(void) strcpy(name, attr.za_name);
|
||||
@@ -1467,7 +1467,7 @@ dmu_dir_list_next(objset_t *os, int namelen, char *name,
|
||||
/* there is no next dir on a snapshot! */
|
||||
if (os->os_dsl_dataset->ds_object !=
|
||||
dd->dd_phys->dd_head_dataset_obj)
|
||||
return (ENOENT);
|
||||
return (SET_ERROR(ENOENT));
|
||||
|
||||
zap_cursor_init_serialized(&cursor,
|
||||
dd->dd_pool->dp_meta_objset,
|
||||
@@ -1475,12 +1475,12 @@ dmu_dir_list_next(objset_t *os, int namelen, char *name,
|
||||
|
||||
if (zap_cursor_retrieve(&cursor, &attr) != 0) {
|
||||
zap_cursor_fini(&cursor);
|
||||
return (ENOENT);
|
||||
return (SET_ERROR(ENOENT));
|
||||
}
|
||||
|
||||
if (strlen(attr.za_name) + 1 > namelen) {
|
||||
zap_cursor_fini(&cursor);
|
||||
return (ENAMETOOLONG);
|
||||
return (SET_ERROR(ENAMETOOLONG));
|
||||
}
|
||||
|
||||
(void) strcpy(name, attr.za_name);
|
||||
@@ -1747,9 +1747,9 @@ dmu_fsname(const char *snapname, char *buf)
|
||||
{
|
||||
char *atp = strchr(snapname, '@');
|
||||
if (atp == NULL)
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
if (atp - snapname >= MAXNAMELEN)
|
||||
return (ENAMETOOLONG);
|
||||
return (SET_ERROR(ENAMETOOLONG));
|
||||
(void) strlcpy(buf, snapname, atp - snapname + 1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user