Deleted Added
full compact
zfs_fm.c (209962) zfs_fm.c (212425)
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

--- 87 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;
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

--- 87 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 error;
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 /*

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

310 * 'stateoroffset' parameter indicates the previous state of the
311 * vdev.
312 */
313 sbuf_printf(&sb, " %s=%ju", FM_EREPORT_PAYLOAD_ZFS_PREV_STATE,
314 stateoroffset);
315 }
316 mutex_exit(&spa->spa_errlist_lock);
317
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 /*

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

311 * 'stateoroffset' parameter indicates the previous state of the
312 * vdev.
313 */
314 sbuf_printf(&sb, " %s=%ju", FM_EREPORT_PAYLOAD_ZFS_PREV_STATE,
315 stateoroffset);
316 }
317 mutex_exit(&spa->spa_errlist_lock);
318
318 sbuf_finish(&sb);
319 error = sbuf_finish(&sb);
319 devctl_notify("ZFS", spa->spa_name, subclass, sbuf_data(&sb));
320 devctl_notify("ZFS", spa->spa_name, subclass, sbuf_data(&sb));
320 if (sbuf_overflowed(&sb))
321 if (error != 0)
321 printf("ZFS WARNING: sbuf overflowed\n");
322 sbuf_delete(&sb);
323#endif
324}
325
326static void
327zfs_post_common(spa_t *spa, vdev_t *vd, const char *name)
328{
329#ifdef _KERNEL
330 char buf[1024];
331 char class[64];
332 struct sbuf sb;
333 struct timespec ts;
322 printf("ZFS WARNING: sbuf overflowed\n");
323 sbuf_delete(&sb);
324#endif
325}
326
327static void
328zfs_post_common(spa_t *spa, vdev_t *vd, const char *name)
329{
330#ifdef _KERNEL
331 char buf[1024];
332 char class[64];
333 struct sbuf sb;
334 struct timespec ts;
335 int error;
334
335 nanotime(&ts);
336
337 sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN);
338 sbuf_printf(&sb, "time=%ju.%ld", (uintmax_t)ts.tv_sec, ts.tv_nsec);
339
340 snprintf(class, sizeof(class), "%s.%s.%s", FM_RSRC_RESOURCE,
341 ZFS_ERROR_CLASS, name);
342 sbuf_printf(&sb, " %s=%hhu", FM_VERSION, FM_RSRC_VERSION);
343 sbuf_printf(&sb, " %s=%s", FM_CLASS, class);
344 sbuf_printf(&sb, " %s=%ju", FM_EREPORT_PAYLOAD_ZFS_POOL_GUID,
345 spa_guid(spa));
346 if (vd)
347 sbuf_printf(&sb, " %s=%ju", FM_EREPORT_PAYLOAD_ZFS_VDEV_GUID,
348 vd->vdev_guid);
336
337 nanotime(&ts);
338
339 sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN);
340 sbuf_printf(&sb, "time=%ju.%ld", (uintmax_t)ts.tv_sec, ts.tv_nsec);
341
342 snprintf(class, sizeof(class), "%s.%s.%s", FM_RSRC_RESOURCE,
343 ZFS_ERROR_CLASS, name);
344 sbuf_printf(&sb, " %s=%hhu", FM_VERSION, FM_RSRC_VERSION);
345 sbuf_printf(&sb, " %s=%s", FM_CLASS, class);
346 sbuf_printf(&sb, " %s=%ju", FM_EREPORT_PAYLOAD_ZFS_POOL_GUID,
347 spa_guid(spa));
348 if (vd)
349 sbuf_printf(&sb, " %s=%ju", FM_EREPORT_PAYLOAD_ZFS_VDEV_GUID,
350 vd->vdev_guid);
349 sbuf_finish(&sb);
351 error = sbuf_finish(&sb);
350 ZFS_LOG(1, "%s", sbuf_data(&sb));
351 devctl_notify("ZFS", spa->spa_name, class, sbuf_data(&sb));
352 ZFS_LOG(1, "%s", sbuf_data(&sb));
353 devctl_notify("ZFS", spa->spa_name, class, sbuf_data(&sb));
352 if (sbuf_overflowed(&sb))
354 if (error != 0)
353 printf("ZFS WARNING: sbuf overflowed\n");
354 sbuf_delete(&sb);
355#endif
356}
357
358/*
359 * The 'resource.fs.zfs.removed' event is an internal signal that the given vdev
360 * has been removed from the system. This will cause the DE to ignore any

--- 19 unchanged lines hidden ---
355 printf("ZFS WARNING: sbuf overflowed\n");
356 sbuf_delete(&sb);
357#endif
358}
359
360/*
361 * The 'resource.fs.zfs.removed' event is an internal signal that the given vdev
362 * has been removed from the system. This will cause the DE to ignore any

--- 19 unchanged lines hidden ---