zfs_fm.c (185029) | zfs_fm.c (209962) |
---|---|
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/* | 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. | 22 * Copyright 2009 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; | 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 | 104 105 /* 106 * If we are doing a spa_tryimport(), ignore errors. 107 */ 108 if (spa->spa_load_state == SPA_LOAD_TRYIMPORT) 109 return; 110 111 /* --- 16 unchanged lines hidden (view full) --- 128 129 /* 130 * Ignore any errors from speculative I/Os, as failure is an 131 * expected result. 132 */ 133 if (zio->io_flags & ZIO_FLAG_SPECULATIVE) 134 return; 135 |
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; | 136 if (vd != NULL) { 137 /* 138 * If the vdev has already been marked as failing due 139 * to a failed probe, then ignore any subsequent I/O 140 * errors, as the DE will automatically fault the vdev 141 * on the first such failure. This also catches cases 142 * where vdev_remove_wanted is set and the device has 143 * not yet been asynchronously placed into the REMOVED 144 * state. 145 */ 146 if (zio->io_vd == vd && 147 !vdev_accessible(vd, zio) && 148 strcmp(subclass, FM_EREPORT_ZFS_PROBE_FAILURE) != 0) 149 return; 150 151 /* 152 * Ignore checksum errors for reads from DTL regions of 153 * leaf vdevs. 154 */ 155 if (zio->io_type == ZIO_TYPE_READ && 156 zio->io_error == ECKSUM && 157 vd->vdev_ops->vdev_op_leaf && 158 vdev_dtl_contains(vd, DTL_MISSING, zio->io_txg, 1)) 159 return; 160 } |
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 /* | 161 } 162 nanotime(&ts); 163 164 sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN); 165 sbuf_printf(&sb, "time=%ju.%ld", (uintmax_t)ts.tv_sec, ts.tv_nsec); 166 167 /* 168 * Serialize ereport generation --- 37 unchanged lines hidden (view full) --- 206 sbuf_printf(&sb, " zfs_scheme_version=%u", FM_ZFS_SCHEME_VERSION); 207 208 /* 209 * Construct the per-ereport payload, depending on which parameters are 210 * passed in. 211 */ 212 213 /* |
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)); | 214 * Generic payload members common to all ereports. 215 */ 216 sbuf_printf(&sb, " %s=%s", FM_EREPORT_PAYLOAD_ZFS_POOL, spa_name(spa)); 217 sbuf_printf(&sb, " %s=%ju", FM_EREPORT_PAYLOAD_ZFS_POOL_GUID, 218 spa_guid(spa)); |
213 sbuf_printf(&sb, " %s=%d", FM_EREPORT_PAYLOAD_ZFS_POOL_CONTEXT, state); | 219 sbuf_printf(&sb, " %s=%d", FM_EREPORT_PAYLOAD_ZFS_POOL_CONTEXT, 220 spa->spa_load_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); | 221 222 if (spa != NULL) { 223 sbuf_printf(&sb, " %s=%s", FM_EREPORT_PAYLOAD_ZFS_POOL_FAILMODE, 224 spa_get_failmode(spa) == ZIO_FAILURE_MODE_WAIT ? 225 FM_EREPORT_FAILMODE_WAIT : 226 spa_get_failmode(spa) == ZIO_FAILURE_MODE_CONTINUE ? 227 FM_EREPORT_FAILMODE_CONTINUE : FM_EREPORT_FAILMODE_PANIC); 228 } 229 230 if (vd != NULL) { 231 vdev_t *pvd = vd->vdev_parent; 232 233 sbuf_printf(&sb, " %s=%ju", FM_EREPORT_PAYLOAD_ZFS_VDEV_GUID, 234 vd->vdev_guid); 235 sbuf_printf(&sb, " %s=%s", FM_EREPORT_PAYLOAD_ZFS_VDEV_TYPE, 236 vd->vdev_ops->vdev_op_type); |
230 if (vd->vdev_path) | 237 if (vd->vdev_path != NULL) |
231 sbuf_printf(&sb, " %s=%s", 232 FM_EREPORT_PAYLOAD_ZFS_VDEV_PATH, vd->vdev_path); | 238 sbuf_printf(&sb, " %s=%s", 239 FM_EREPORT_PAYLOAD_ZFS_VDEV_PATH, vd->vdev_path); |
233 if (vd->vdev_devid) | 240 if (vd->vdev_devid != NULL) |
234 sbuf_printf(&sb, " %s=%s", 235 FM_EREPORT_PAYLOAD_ZFS_VDEV_DEVID, vd->vdev_devid); | 241 sbuf_printf(&sb, " %s=%s", 242 FM_EREPORT_PAYLOAD_ZFS_VDEV_DEVID, vd->vdev_devid); |
243 if (vd->vdev_fru != NULL) 244 sbuf_printf(&sb, " %s=%s", 245 FM_EREPORT_PAYLOAD_ZFS_VDEV_FRU, vd->vdev_fru); |
|
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 --- | 246 247 if (pvd != NULL) { 248 sbuf_printf(&sb, " %s=%ju", 249 FM_EREPORT_PAYLOAD_ZFS_PARENT_GUID, pvd->vdev_guid); 250 sbuf_printf(&sb, " %s=%s", 251 FM_EREPORT_PAYLOAD_ZFS_PARENT_TYPE, 252 pvd->vdev_ops->vdev_op_type); 253 if (pvd->vdev_path) --- 126 unchanged lines hidden --- |