Deleted Added
sdiff udiff text old ( 185029 ) new ( 209962 )
full compact
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 5 unchanged lines hidden (view full) ---

14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#include <sys/spa.h>
27#include <sys/spa_impl.h>
28#include <sys/vdev.h>
29#include <sys/vdev_impl.h>
30#include <sys/zio.h>

--- 65 unchanged lines hidden (view full) ---

96void
97zfs_ereport_post(const char *subclass, spa_t *spa, vdev_t *vd, zio_t *zio,
98 uint64_t stateoroffset, uint64_t size)
99{
100#ifdef _KERNEL
101 char buf[1024];
102 struct sbuf sb;
103 struct timespec ts;
104 int state;
105
106 /*
107 * If we are doing a spa_tryimport(), ignore errors.
108 */
109 if (spa->spa_load_state == SPA_LOAD_TRYIMPORT)
110 return;
111
112 /*

--- 16 unchanged lines hidden (view full) ---

129
130 /*
131 * Ignore any errors from speculative I/Os, as failure is an
132 * expected result.
133 */
134 if (zio->io_flags & ZIO_FLAG_SPECULATIVE)
135 return;
136
137 /*
138 * If the vdev has already been marked as failing due to a
139 * failed probe, then ignore any subsequent I/O errors, as the
140 * DE will automatically fault the vdev on the first such
141 * failure.
142 */
143 if (vd != NULL &&
144 (!vdev_readable(vd) || !vdev_writeable(vd)) &&
145 strcmp(subclass, FM_EREPORT_ZFS_PROBE_FAILURE) != 0)
146 return;
147 }
148 nanotime(&ts);
149
150 sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN);
151 sbuf_printf(&sb, "time=%ju.%ld", (uintmax_t)ts.tv_sec, ts.tv_nsec);
152
153 /*
154 * Serialize ereport generation

--- 37 unchanged lines hidden (view full) ---

192 sbuf_printf(&sb, " zfs_scheme_version=%u", FM_ZFS_SCHEME_VERSION);
193
194 /*
195 * Construct the per-ereport payload, depending on which parameters are
196 * passed in.
197 */
198
199 /*
200 * If we are importing a faulted pool, then we treat it like an open,
201 * not an import. Otherwise, the DE will ignore all faults during
202 * import, since the default behavior is to mark the devices as
203 * persistently unavailable, not leave them in the faulted state.
204 */
205 state = spa->spa_import_faulted ? SPA_LOAD_OPEN : spa->spa_load_state;
206
207 /*
208 * Generic payload members common to all ereports.
209 */
210 sbuf_printf(&sb, " %s=%s", FM_EREPORT_PAYLOAD_ZFS_POOL, spa_name(spa));
211 sbuf_printf(&sb, " %s=%ju", FM_EREPORT_PAYLOAD_ZFS_POOL_GUID,
212 spa_guid(spa));
213 sbuf_printf(&sb, " %s=%d", FM_EREPORT_PAYLOAD_ZFS_POOL_CONTEXT, state);
214
215 if (spa != NULL) {
216 sbuf_printf(&sb, " %s=%s", FM_EREPORT_PAYLOAD_ZFS_POOL_FAILMODE,
217 spa_get_failmode(spa) == ZIO_FAILURE_MODE_WAIT ?
218 FM_EREPORT_FAILMODE_WAIT :
219 spa_get_failmode(spa) == ZIO_FAILURE_MODE_CONTINUE ?
220 FM_EREPORT_FAILMODE_CONTINUE : FM_EREPORT_FAILMODE_PANIC);
221 }
222
223 if (vd != NULL) {
224 vdev_t *pvd = vd->vdev_parent;
225
226 sbuf_printf(&sb, " %s=%ju", FM_EREPORT_PAYLOAD_ZFS_VDEV_GUID,
227 vd->vdev_guid);
228 sbuf_printf(&sb, " %s=%s", FM_EREPORT_PAYLOAD_ZFS_VDEV_TYPE,
229 vd->vdev_ops->vdev_op_type);
230 if (vd->vdev_path)
231 sbuf_printf(&sb, " %s=%s",
232 FM_EREPORT_PAYLOAD_ZFS_VDEV_PATH, vd->vdev_path);
233 if (vd->vdev_devid)
234 sbuf_printf(&sb, " %s=%s",
235 FM_EREPORT_PAYLOAD_ZFS_VDEV_DEVID, vd->vdev_devid);
236
237 if (pvd != NULL) {
238 sbuf_printf(&sb, " %s=%ju",
239 FM_EREPORT_PAYLOAD_ZFS_PARENT_GUID, pvd->vdev_guid);
240 sbuf_printf(&sb, " %s=%s",
241 FM_EREPORT_PAYLOAD_ZFS_PARENT_TYPE,
242 pvd->vdev_ops->vdev_op_type);
243 if (pvd->vdev_path)

--- 126 unchanged lines hidden ---