diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index fc378fc97d..fb87ec46de 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -4431,7 +4431,7 @@ zpool_do_events_next(ev_opts_t *opts) nvlist_t *nvl; int ret, dropped; - (void) printf(gettext("%-27s %s\n"), "TIME", "CLASS"); + (void) printf(gettext("%-30s %s\n"), "TIME", "CLASS"); while (1) { ret = zpool_events_next(g_zfs, &nvl, &dropped, !!opts->follow); diff --git a/module/zfs/fm.c b/module/zfs/fm.c index 0c94ade288..62ab7b58f8 100644 --- a/module/zfs/fm.c +++ b/module/zfs/fm.c @@ -496,9 +496,19 @@ fm_zevent_insert(zevent_t *ev) void fm_zevent_post(nvlist_t *nvl, nvlist_t *detector, zevent_cb_t *cb) { + int64_t tv_array[2]; + timestruc_t tv; size_t nvl_size = 0; zevent_t *ev; + gethrestime(&tv); + tv_array[0] = tv.tv_sec; + tv_array[1] = tv.tv_nsec; + if (nvlist_add_int64_array(nvl, FM_EREPORT_TIME, tv_array, 2)) { + atomic_add_64(&erpt_kstat_data.erpt_set_failed.value.ui64, 1); + return; + } + (void) nvlist_size(nvl, &nvl_size, NV_ENCODE_NATIVE); if (nvl_size > ERPT_DATA_SZ || nvl_size == 0) { atomic_add_64(&erpt_kstat_data.erpt_dropped.value.ui64, 1); @@ -892,8 +902,6 @@ fm_ereport_set(nvlist_t *ereport, int version, const char *erpt_class, { char ereport_class[FM_MAX_CLASS]; const char *name; - timestruc_t tv; - int64_t tv_array[2]; va_list ap; int ret; @@ -925,13 +933,6 @@ fm_ereport_set(nvlist_t *ereport, int version, const char *erpt_class, if (ret) atomic_add_64(&erpt_kstat_data.erpt_set_failed.value.ui64, 1); - - gethrestime(&tv); - tv_array[0] = tv.tv_sec; - tv_array[1] = tv.tv_nsec; - if (nvlist_add_int64_array(ereport, FM_EREPORT_TIME, tv_array, 2)) { - atomic_add_64(&erpt_kstat_data.erpt_set_failed.value.ui64, 1); - } } /* diff --git a/module/zfs/include/sys/fm/fs/zfs.h b/module/zfs/include/sys/fm/fs/zfs.h index 70f0843faf..ba542d8220 100644 --- a/module/zfs/include/sys/fm/fs/zfs.h +++ b/module/zfs/include/sys/fm/fs/zfs.h @@ -67,6 +67,7 @@ extern "C" { #define FM_EREPORT_PAYLOAD_ZFS_VDEV_PATH "vdev_path" #define FM_EREPORT_PAYLOAD_ZFS_VDEV_DEVID "vdev_devid" #define FM_EREPORT_PAYLOAD_ZFS_VDEV_FRU "vdev_fru" +#define FM_EREPORT_PAYLOAD_ZFS_VDEV_STATE "vdev_state" #define FM_EREPORT_PAYLOAD_ZFS_PARENT_GUID "parent_guid" #define FM_EREPORT_PAYLOAD_ZFS_PARENT_TYPE "parent_type" #define FM_EREPORT_PAYLOAD_ZFS_PARENT_PATH "parent_path" diff --git a/module/zfs/zfs_fm.c b/module/zfs/zfs_fm.c index 409f4f99fb..a74f195778 100644 --- a/module/zfs/zfs_fm.c +++ b/module/zfs/zfs_fm.c @@ -820,9 +820,12 @@ zfs_post_common(spa_t *spa, vdev_t *vd, const char *name) VERIFY(nvlist_add_string(resource, FM_CLASS, class) == 0); VERIFY(nvlist_add_uint64(resource, FM_EREPORT_PAYLOAD_ZFS_POOL_GUID, spa_guid(spa)) == 0); - if (vd) + if (vd) { VERIFY(nvlist_add_uint64(resource, FM_EREPORT_PAYLOAD_ZFS_VDEV_GUID, vd->vdev_guid) == 0); + VERIFY(nvlist_add_uint64(resource, + FM_EREPORT_PAYLOAD_ZFS_VDEV_STATE, vd->vdev_state) == 0); + } fm_zevent_post(resource, NULL, zfs_zevent_post_cb); #endif