mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 19:04:45 +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
+25
-25
@@ -22,7 +22,7 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <sys/zfs_context.h>
|
||||
@@ -355,10 +355,10 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent, uint_t id,
|
||||
ASSERT(spa_config_held(spa, SCL_ALL, RW_WRITER) == SCL_ALL);
|
||||
|
||||
if (nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &type) != 0)
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
|
||||
if ((ops = vdev_getops(type)) == NULL)
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
|
||||
/*
|
||||
* If this is a load, get the vdev guid from the nvlist.
|
||||
@@ -369,26 +369,26 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent, uint_t id,
|
||||
|
||||
if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_ID, &label_id) ||
|
||||
label_id != id)
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
|
||||
if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &guid) != 0)
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
} else if (alloctype == VDEV_ALLOC_SPARE) {
|
||||
if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &guid) != 0)
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
} else if (alloctype == VDEV_ALLOC_L2CACHE) {
|
||||
if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &guid) != 0)
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
} else if (alloctype == VDEV_ALLOC_ROOTPOOL) {
|
||||
if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &guid) != 0)
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
}
|
||||
|
||||
/*
|
||||
* The first allocated vdev must be of type 'root'.
|
||||
*/
|
||||
if (ops != &vdev_root_ops && spa->spa_root_vdev == NULL)
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
|
||||
/*
|
||||
* Determine whether we're a log vdev.
|
||||
@@ -396,10 +396,10 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent, uint_t id,
|
||||
islog = 0;
|
||||
(void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_IS_LOG, &islog);
|
||||
if (islog && spa_version(spa) < SPA_VERSION_SLOGS)
|
||||
return (ENOTSUP);
|
||||
return (SET_ERROR(ENOTSUP));
|
||||
|
||||
if (ops == &vdev_hole_ops && spa_version(spa) < SPA_VERSION_HOLES)
|
||||
return (ENOTSUP);
|
||||
return (SET_ERROR(ENOTSUP));
|
||||
|
||||
/*
|
||||
* Set the nparity property for RAID-Z vdevs.
|
||||
@@ -409,24 +409,24 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent, uint_t id,
|
||||
if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NPARITY,
|
||||
&nparity) == 0) {
|
||||
if (nparity == 0 || nparity > VDEV_RAIDZ_MAXPARITY)
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
/*
|
||||
* Previous versions could only support 1 or 2 parity
|
||||
* device.
|
||||
*/
|
||||
if (nparity > 1 &&
|
||||
spa_version(spa) < SPA_VERSION_RAIDZ2)
|
||||
return (ENOTSUP);
|
||||
return (SET_ERROR(ENOTSUP));
|
||||
if (nparity > 2 &&
|
||||
spa_version(spa) < SPA_VERSION_RAIDZ3)
|
||||
return (ENOTSUP);
|
||||
return (SET_ERROR(ENOTSUP));
|
||||
} else {
|
||||
/*
|
||||
* We require the parity to be specified for SPAs that
|
||||
* support multiple parity levels.
|
||||
*/
|
||||
if (spa_version(spa) >= SPA_VERSION_RAIDZ2)
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
/*
|
||||
* Otherwise, we default to 1 parity device for RAID-Z.
|
||||
*/
|
||||
@@ -949,7 +949,7 @@ vdev_probe_done(zio_t *zio)
|
||||
ASSERT(zio->io_error != 0);
|
||||
zfs_ereport_post(FM_EREPORT_ZFS_PROBE_FAILURE,
|
||||
spa, vd, NULL, 0, 0);
|
||||
zio->io_error = ENXIO;
|
||||
zio->io_error = SET_ERROR(ENXIO);
|
||||
}
|
||||
|
||||
mutex_enter(&vd->vdev_probe_lock);
|
||||
@@ -959,7 +959,7 @@ vdev_probe_done(zio_t *zio)
|
||||
|
||||
while ((pio = zio_walk_parents(zio)) != NULL)
|
||||
if (!vdev_accessible(vd, pio))
|
||||
pio->io_error = ENXIO;
|
||||
pio->io_error = SET_ERROR(ENXIO);
|
||||
|
||||
kmem_free(vps, sizeof (*vps));
|
||||
}
|
||||
@@ -1152,11 +1152,11 @@ vdev_open(vdev_t *vd)
|
||||
vd->vdev_label_aux == VDEV_AUX_EXTERNAL);
|
||||
vdev_set_state(vd, B_TRUE, VDEV_STATE_FAULTED,
|
||||
vd->vdev_label_aux);
|
||||
return (ENXIO);
|
||||
return (SET_ERROR(ENXIO));
|
||||
} else if (vd->vdev_offline) {
|
||||
ASSERT(vd->vdev_children == 0);
|
||||
vdev_set_state(vd, B_TRUE, VDEV_STATE_OFFLINE, VDEV_AUX_NONE);
|
||||
return (ENXIO);
|
||||
return (SET_ERROR(ENXIO));
|
||||
}
|
||||
|
||||
error = vd->vdev_ops->vdev_op_open(vd, &osize, &max_osize, &ashift);
|
||||
@@ -1191,7 +1191,7 @@ vdev_open(vdev_t *vd)
|
||||
vd->vdev_label_aux == VDEV_AUX_EXTERNAL);
|
||||
vdev_set_state(vd, B_TRUE, VDEV_STATE_FAULTED,
|
||||
vd->vdev_label_aux);
|
||||
return (ENXIO);
|
||||
return (SET_ERROR(ENXIO));
|
||||
}
|
||||
|
||||
if (vd->vdev_degraded) {
|
||||
@@ -1223,7 +1223,7 @@ vdev_open(vdev_t *vd)
|
||||
if (osize < SPA_MINDEVSIZE) {
|
||||
vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN,
|
||||
VDEV_AUX_TOO_SMALL);
|
||||
return (EOVERFLOW);
|
||||
return (SET_ERROR(EOVERFLOW));
|
||||
}
|
||||
psize = osize;
|
||||
asize = osize - (VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE);
|
||||
@@ -1234,7 +1234,7 @@ vdev_open(vdev_t *vd)
|
||||
(VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE)) {
|
||||
vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN,
|
||||
VDEV_AUX_TOO_SMALL);
|
||||
return (EOVERFLOW);
|
||||
return (SET_ERROR(EOVERFLOW));
|
||||
}
|
||||
psize = 0;
|
||||
asize = osize;
|
||||
@@ -1249,7 +1249,7 @@ vdev_open(vdev_t *vd)
|
||||
if (asize < vd->vdev_min_asize) {
|
||||
vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN,
|
||||
VDEV_AUX_BAD_LABEL);
|
||||
return (EINVAL);
|
||||
return (SET_ERROR(EINVAL));
|
||||
}
|
||||
|
||||
if (vd->vdev_asize == 0) {
|
||||
@@ -1336,7 +1336,7 @@ vdev_validate(vdev_t *vd, boolean_t strict)
|
||||
|
||||
for (c = 0; c < vd->vdev_children; c++)
|
||||
if (vdev_validate(vd->vdev_child[c], strict) != 0)
|
||||
return (EBADF);
|
||||
return (SET_ERROR(EBADF));
|
||||
|
||||
/*
|
||||
* If the device has already failed, or was marked offline, don't do
|
||||
@@ -1422,7 +1422,7 @@ vdev_validate(vdev_t *vd, boolean_t strict)
|
||||
if (!(spa->spa_import_flags & ZFS_IMPORT_VERBATIM) &&
|
||||
spa_load_state(spa) == SPA_LOAD_OPEN &&
|
||||
state != POOL_STATE_ACTIVE)
|
||||
return (EBADF);
|
||||
return (SET_ERROR(EBADF));
|
||||
|
||||
/*
|
||||
* If we were able to open and validate a vdev that was
|
||||
|
||||
Reference in New Issue
Block a user