summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorDave Eddy <[email protected]>2017-05-30 11:39:17 -0700
committerBrian Behlendorf <[email protected]>2017-07-12 21:28:13 -0700
commit12fa0466df8773fc6151e8b55367a1c4f76ec407 (patch)
treedc8627f3df85f8d2c0ce515afec0d17f20702a98 /module
parent314be68aa93a543f89d7c0137f25848e4c692653 (diff)
OpenZFS 6939 - add sysevents to zfs core for commands
Authored by: Dave Eddy <[email protected]> Reviewed by: Patrick Mooney <[email protected]> Reviewed by: Joshua M. Clulow <[email protected]> Reviewed by: Josh Wilsdon <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Richard Elling <[email protected]> Reviewed by: Alan Somers <[email protected]> Reviewed by: Andrew Stormont <[email protected]> Approved by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Ported-by: Giuseppe Di Natale <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/6939 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/ce1577b Closes #6328
Diffstat (limited to 'module')
-rw-r--r--module/zfs/dsl_scan.c9
-rw-r--r--module/zfs/spa.c72
-rw-r--r--module/zfs/spa_config.c3
-rw-r--r--module/zfs/spa_history.c83
-rw-r--r--module/zfs/vdev.c5
-rw-r--r--module/zfs/zfs_fm.c59
6 files changed, 182 insertions, 49 deletions
diff --git a/module/zfs/dsl_scan.c b/module/zfs/dsl_scan.c
index 369ccd8a7..74cbce0d3 100644
--- a/module/zfs/dsl_scan.c
+++ b/module/zfs/dsl_scan.c
@@ -23,6 +23,7 @@
* Copyright (c) 2011, 2016 by Delphix. All rights reserved.
* Copyright 2016 Gary Mills
* Copyright (c) 2017 Datto Inc.
+ * Copyright 2017 Joyent, Inc.
*/
#include <sys/dsl_scan.h>
@@ -249,9 +250,10 @@ dsl_scan_setup_sync(void *arg, dmu_tx_t *tx)
if (vdev_resilver_needed(spa->spa_root_vdev,
&scn->scn_phys.scn_min_txg, &scn->scn_phys.scn_max_txg)) {
- spa_event_notify(spa, NULL, ESC_ZFS_RESILVER_START);
+ spa_event_notify(spa, NULL, NULL,
+ ESC_ZFS_RESILVER_START);
} else {
- spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_START);
+ spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_START);
}
spa->spa_scrub_started = B_TRUE;
@@ -360,7 +362,8 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu_tx_t *tx)
vdev_dtl_reassess(spa->spa_root_vdev, tx->tx_txg,
complete ? scn->scn_phys.scn_max_txg : 0, B_TRUE);
if (complete) {
- spa_event_notify(spa, NULL, scn->scn_phys.scn_min_txg ?
+ spa_event_notify(spa, NULL, NULL,
+ scn->scn_phys.scn_min_txg ?
ESC_ZFS_RESILVER_FINISH : ESC_ZFS_SCRUB_FINISH);
}
spa_errlog_rotate(spa);
diff --git a/module/zfs/spa.c b/module/zfs/spa.c
index d759ce718..52420194c 100644
--- a/module/zfs/spa.c
+++ b/module/zfs/spa.c
@@ -30,6 +30,7 @@
* Copyright 2016 Toomas Soome <[email protected]>
* Copyright (c) 2016 Actifio, Inc. All rights reserved.
* Copyright (c) 2017 Datto Inc.
+ * Copyright 2017 Joyent, Inc.
*/
/*
@@ -77,6 +78,8 @@
#include <sys/zvol.h>
#ifdef _KERNEL
+#include <sys/fm/protocol.h>
+#include <sys/fm/util.h>
#include <sys/bootprops.h>
#include <sys/callb.h>
#include <sys/cpupart.h>
@@ -146,6 +149,9 @@ const zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ_TYPES] = {
{ ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* IOCTL */
};
+static sysevent_t *spa_event_create(spa_t *spa, vdev_t *vd, nvlist_t *hist_nvl,
+ const char *name);
+static void spa_event_post(sysevent_t *ev);
static void spa_sync_version(void *arg, dmu_tx_t *tx);
static void spa_sync_props(void *arg, dmu_tx_t *tx);
static boolean_t spa_has_active_shared_spare(spa_t *spa);
@@ -801,7 +807,7 @@ spa_change_guid(spa_t *spa)
if (error == 0) {
spa_config_sync(spa, B_FALSE, B_TRUE);
- spa_event_notify(spa, NULL, ESC_ZFS_POOL_REGUID);
+ spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_REGUID);
}
mutex_exit(&spa_namespace_lock);
@@ -1701,7 +1707,7 @@ spa_check_removed(vdev_t *vd)
if (vd->vdev_ops->vdev_op_leaf && vdev_is_dead(vd) &&
!vd->vdev_ishole) {
zfs_post_autoreplace(vd->vdev_spa, vd);
- spa_event_notify(vd->vdev_spa, vd, ESC_ZFS_VDEV_CHECK);
+ spa_event_notify(vd->vdev_spa, vd, NULL, ESC_ZFS_VDEV_CHECK);
}
}
@@ -3998,7 +4004,7 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props,
txg_wait_synced(spa->spa_dsl_pool, txg);
spa_config_sync(spa, B_FALSE, B_TRUE);
- spa_event_notify(spa, NULL, ESC_ZFS_POOL_CREATE);
+ spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_CREATE);
spa_history_log_version(spa, "create");
@@ -4062,7 +4068,7 @@ spa_import(char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags)
spa_configfile_set(spa, props, B_FALSE);
spa_config_sync(spa, B_FALSE, B_TRUE);
- spa_event_notify(spa, NULL, ESC_ZFS_POOL_IMPORT);
+ spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_IMPORT);
mutex_exit(&spa_namespace_lock);
return (0);
@@ -4189,7 +4195,7 @@ spa_import(char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags)
spa_history_log_version(spa, "import");
- spa_event_notify(spa, NULL, ESC_ZFS_POOL_IMPORT);
+ spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_IMPORT);
zvol_create_minors(spa, pool, B_TRUE);
@@ -4390,7 +4396,7 @@ spa_export_common(char *pool, int new_state, nvlist_t **oldconfig,
}
export_spa:
- spa_event_notify(spa, NULL, ESC_ZFS_POOL_DESTROY);
+ spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_DESTROY);
if (spa->spa_state != POOL_STATE_UNINITIALIZED) {
spa_unload(spa);
@@ -4546,7 +4552,7 @@ spa_vdev_add(spa_t *spa, nvlist_t *nvroot)
mutex_enter(&spa_namespace_lock);
spa_config_update(spa, SPA_CONFIG_UPDATE_POOL);
- spa_event_notify(spa, NULL, ESC_ZFS_VDEV_ADD);
+ spa_event_notify(spa, NULL, NULL, ESC_ZFS_VDEV_ADD);
mutex_exit(&spa_namespace_lock);
return (0);
@@ -4727,7 +4733,7 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing)
if (newvd->vdev_isspare) {
spa_spare_activate(newvd);
- spa_event_notify(spa, newvd, ESC_ZFS_VDEV_SPARE);
+ spa_event_notify(spa, newvd, NULL, ESC_ZFS_VDEV_SPARE);
}
oldvdpath = spa_strdup(oldvd->vdev_path);
@@ -4747,9 +4753,9 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing)
dsl_resilver_restart(spa->spa_dsl_pool, dtl_max_txg);
if (spa->spa_bootfs)
- spa_event_notify(spa, newvd, ESC_ZFS_BOOTFS_VDEV_ATTACH);
+ spa_event_notify(spa, newvd, NULL, ESC_ZFS_BOOTFS_VDEV_ATTACH);
- spa_event_notify(spa, newvd, ESC_ZFS_VDEV_ATTACH);
+ spa_event_notify(spa, newvd, NULL, ESC_ZFS_VDEV_ATTACH);
/*
* Commit the config
@@ -4963,7 +4969,7 @@ spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pguid, int replace_done)
vd->vdev_detached = B_TRUE;
vdev_dirty(tvd, VDD_DTL, vd, txg);
- spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE);
+ spa_event_notify(spa, vd, NULL, ESC_ZFS_VDEV_REMOVE);
/* hang on to the spa before we release the lock */
spa_open_ref(spa, FTAG);
@@ -5449,6 +5455,7 @@ int
spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare)
{
vdev_t *vd;
+ sysevent_t *ev = NULL;
metaslab_group_t *mg;
nvlist_t **spares, **l2cache, *nv;
uint64_t txg = 0;
@@ -5474,7 +5481,8 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare)
if (vd == NULL || unspare) {
if (vd == NULL)
vd = spa_lookup_by_guid(spa, guid, B_TRUE);
- spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
+ ev = spa_event_create(spa, vd, NULL,
+ ESC_ZFS_VDEV_REMOVE_AUX);
spa_vdev_remove_aux(spa->spa_spares.sav_config,
ZPOOL_CONFIG_SPARES, spares, nspares, nv);
spa_load_spares(spa);
@@ -5490,7 +5498,7 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare)
* Cache devices can always be removed.
*/
vd = spa_lookup_by_guid(spa, guid, B_TRUE);
- spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
+ ev = spa_event_create(spa, vd, NULL, ESC_ZFS_VDEV_REMOVE_AUX);
spa_vdev_remove_aux(spa->spa_l2cache.sav_config,
ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv);
spa_load_l2cache(spa);
@@ -5531,7 +5539,7 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare)
/*
* Clean up the vdev namespace.
*/
- spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV);
+ ev = spa_event_create(spa, vd, NULL, ESC_ZFS_VDEV_REMOVE_DEV);
spa_vdev_remove_from_namespace(spa, vd);
} else if (vd != NULL) {
@@ -5549,6 +5557,9 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare)
if (!locked)
error = spa_vdev_exit(spa, NULL, txg, error);
+ if (ev)
+ spa_event_post(ev);
+
return (error);
}
@@ -5831,7 +5842,7 @@ spa_async_autoexpand(spa_t *spa, vdev_t *vd)
if (!vd->vdev_ops->vdev_op_leaf || vd->vdev_physpath == NULL)
return;
- spa_event_notify(vd->vdev_spa, vd, ESC_ZFS_VDEV_AUTOEXPAND);
+ spa_event_notify(vd->vdev_spa, vd, NULL, ESC_ZFS_VDEV_AUTOEXPAND);
}
static void
@@ -6944,6 +6955,33 @@ spa_has_active_shared_spare(spa_t *spa)
return (B_FALSE);
}
+static sysevent_t *
+spa_event_create(spa_t *spa, vdev_t *vd, nvlist_t *hist_nvl, const char *name)
+{
+ sysevent_t *ev = NULL;
+#ifdef _KERNEL
+ nvlist_t *resource;
+
+ resource = zfs_event_create(spa, vd, FM_SYSEVENT_CLASS, name, hist_nvl);
+ if (resource) {
+ ev = kmem_alloc(sizeof (sysevent_t), KM_SLEEP);
+ ev->resource = resource;
+ }
+#endif
+ return (ev);
+}
+
+static void
+spa_event_post(sysevent_t *ev)
+{
+#ifdef _KERNEL
+ if (ev) {
+ zfs_zevent_post(ev->resource, NULL, zfs_zevent_post_cb);
+ kmem_free(ev, sizeof (*ev));
+ }
+#endif
+}
+
/*
* Post a zevent corresponding to the given sysevent. The 'name' must be one
* of the event definitions in sys/sysevent/eventdefs.h. The payload will be
@@ -6952,9 +6990,9 @@ spa_has_active_shared_spare(spa_t *spa)
* or zdb as real changes.
*/
void
-spa_event_notify(spa_t *spa, vdev_t *vd, const char *name)
+spa_event_notify(spa_t *spa, vdev_t *vd, nvlist_t *hist_nvl, const char *name)
{
- zfs_post_sysevent(spa, vd, name);
+ spa_event_post(spa_event_create(spa, vd, hist_nvl, name));
}
#if defined(_KERNEL) && defined(HAVE_SPL)
diff --git a/module/zfs/spa_config.c b/module/zfs/spa_config.c
index 0240da2b9..2715898cc 100644
--- a/module/zfs/spa_config.c
+++ b/module/zfs/spa_config.c
@@ -23,6 +23,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
+ * Copyright 2017 Joyent, Inc.
*/
#include <sys/spa.h>
@@ -330,7 +331,7 @@ spa_config_sync(spa_t *target, boolean_t removing, boolean_t postsysevent)
spa_config_generation++;
if (postsysevent)
- spa_event_notify(target, NULL, ESC_ZFS_CONFIG_SYNC);
+ spa_event_notify(target, NULL, NULL, ESC_ZFS_CONFIG_SYNC);
}
/*
diff --git a/module/zfs/spa_history.c b/module/zfs/spa_history.c
index 4ae74c284..6dfc927b2 100644
--- a/module/zfs/spa_history.c
+++ b/module/zfs/spa_history.c
@@ -22,6 +22,8 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2014 Integros [integros.com]
+ * Copyright 2017 Joyent, Inc.
*/
#include <sys/spa.h>
@@ -192,6 +194,71 @@ spa_history_zone(void)
}
/*
+ * Post a history sysevent.
+ *
+ * The nvlist_t* passed into this function will be transformed into a new
+ * nvlist where:
+ *
+ * 1. Nested nvlists will be flattened to a single level
+ * 2. Keys will have their names normalized (to remove any problematic
+ * characters, such as whitespace)
+ *
+ * The nvlist_t passed into this function will duplicated and should be freed
+ * by caller.
+ *
+ */
+static void
+spa_history_log_notify(spa_t *spa, nvlist_t *nvl)
+{
+ nvlist_t *hist_nvl = fnvlist_alloc();
+ uint64_t uint64;
+ char *string;
+
+ if (nvlist_lookup_string(nvl, ZPOOL_HIST_CMD, &string) == 0)
+ fnvlist_add_string(hist_nvl, ZFS_EV_HIST_CMD, string);
+
+ if (nvlist_lookup_string(nvl, ZPOOL_HIST_INT_NAME, &string) == 0)
+ fnvlist_add_string(hist_nvl, ZFS_EV_HIST_INT_NAME, string);
+
+ if (nvlist_lookup_string(nvl, ZPOOL_HIST_ZONE, &string) == 0)
+ fnvlist_add_string(hist_nvl, ZFS_EV_HIST_ZONE, string);
+
+ if (nvlist_lookup_string(nvl, ZPOOL_HIST_HOST, &string) == 0)
+ fnvlist_add_string(hist_nvl, ZFS_EV_HIST_HOST, string);
+
+ if (nvlist_lookup_string(nvl, ZPOOL_HIST_DSNAME, &string) == 0)
+ fnvlist_add_string(hist_nvl, ZFS_EV_HIST_DSNAME, string);
+
+ if (nvlist_lookup_string(nvl, ZPOOL_HIST_INT_STR, &string) == 0)
+ fnvlist_add_string(hist_nvl, ZFS_EV_HIST_INT_STR, string);
+
+ if (nvlist_lookup_string(nvl, ZPOOL_HIST_IOCTL, &string) == 0)
+ fnvlist_add_string(hist_nvl, ZFS_EV_HIST_IOCTL, string);
+
+ if (nvlist_lookup_string(nvl, ZPOOL_HIST_INT_NAME, &string) == 0)
+ fnvlist_add_string(hist_nvl, ZFS_EV_HIST_INT_NAME, string);
+
+ if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_DSID, &uint64) == 0)
+ fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_DSID, uint64);
+
+ if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_TXG, &uint64) == 0)
+ fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_TXG, uint64);
+
+ if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_TIME, &uint64) == 0)
+ fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_TIME, uint64);
+
+ if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_WHO, &uint64) == 0)
+ fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_WHO, uint64);
+
+ if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_INT_EVENT, &uint64) == 0)
+ fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_INT_EVENT, uint64);
+
+ spa_event_notify(spa, NULL, hist_nvl, ESC_ZFS_HISTORY_EVENT);
+
+ nvlist_free(hist_nvl);
+}
+
+/*
* Write out a history event.
*/
/*ARGSUSED*/
@@ -254,6 +321,22 @@ spa_history_log_sync(void *arg, dmu_tx_t *tx)
fnvlist_lookup_string(nvl, ZPOOL_HIST_INT_NAME),
fnvlist_lookup_string(nvl, ZPOOL_HIST_INT_STR));
}
+ /*
+ * The history sysevent is posted only for internal history
+ * messages to show what has happened, not how it happened. For
+ * example, the following command:
+ *
+ * # zfs destroy -r tank/foo
+ *
+ * will result in one sysevent posted per dataset that is
+ * destroyed as a result of the command - which could be more
+ * than one event in total. By contrast, if the sysevent was
+ * posted as a result of the ZPOOL_HIST_CMD key being present
+ * it would result in only one sysevent being posted with the
+ * full command line arguments, requiring the consumer to know
+ * how to parse and understand zfs(1M) command invocations.
+ */
+ spa_history_log_notify(spa, nvl);
} else if (nvlist_exists(nvl, ZPOOL_HIST_IOCTL)) {
zfs_dbgmsg("ioctl %s",
fnvlist_lookup_string(nvl, ZPOOL_HIST_IOCTL));
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
index 1bca227db..df07d893d 100644
--- a/module/zfs/vdev.c
+++ b/module/zfs/vdev.c
@@ -25,6 +25,7 @@
* Copyright 2017 Nexenta Systems, Inc.
* Copyright (c) 2014 Integros [integros.com]
* Copyright 2016 Toomas Soome <[email protected]>
+ * Copyright 2017 Joyent, Inc.
*/
#include <sys/zfs_context.h>
@@ -2657,7 +2658,7 @@ vdev_online(spa_t *spa, uint64_t guid, uint64_t flags, vdev_state_t *newstate)
if (wasoffline ||
(oldstate < VDEV_STATE_DEGRADED &&
vd->vdev_state >= VDEV_STATE_DEGRADED))
- spa_event_notify(spa, vd, ESC_ZFS_VDEV_ONLINE);
+ spa_event_notify(spa, vd, NULL, ESC_ZFS_VDEV_ONLINE);
return (spa_vdev_state_exit(spa, vd, 0));
}
@@ -2821,7 +2822,7 @@ vdev_clear(spa_t *spa, vdev_t *vd)
if (vd->vdev_aux == NULL && !vdev_is_dead(vd))
spa_async_request(spa, SPA_ASYNC_RESILVER);
- spa_event_notify(spa, vd, ESC_ZFS_VDEV_CLEAR);
+ spa_event_notify(spa, vd, NULL, ESC_ZFS_VDEV_CLEAR);
}
/*
diff --git a/module/zfs/zfs_fm.c b/module/zfs/zfs_fm.c
index fedceee19..3986b3959 100644
--- a/module/zfs/zfs_fm.c
+++ b/module/zfs/zfs_fm.c
@@ -102,7 +102,7 @@
* ereport with information about the differences.
*/
#ifdef _KERNEL
-static void
+void
zfs_zevent_post_cb(nvlist_t *nvl, nvlist_t *detector)
{
if (nvl)
@@ -904,19 +904,25 @@ zfs_ereport_post_checksum(spa_t *spa, vdev_t *vd,
#endif
}
-static void
-zfs_post_common(spa_t *spa, vdev_t *vd, const char *type, const char *name,
+/*
+ * The 'sysevent.fs.zfs.*' events are signals posted to notify user space of
+ * change in the pool. All sysevents are listed in sys/sysevent/eventdefs.h
+ * and are designed to be consumed by the ZFS Event Daemon (ZED). For
+ * additional details refer to the zed(8) man page.
+ */
+nvlist_t *
+zfs_event_create(spa_t *spa, vdev_t *vd, const char *type, const char *name,
nvlist_t *aux)
{
+ nvlist_t *resource = NULL;
#ifdef _KERNEL
- nvlist_t *resource;
char class[64];
if (spa_load_state(spa) == SPA_LOAD_TRYIMPORT)
- return;
+ return (NULL);
if ((resource = fm_nvlist_create(NULL)) == NULL)
- return;
+ return (NULL);
(void) snprintf(class, sizeof (class), "%s.%s.%s", type,
ZFS_ERROR_CLASS, name);
@@ -949,16 +955,30 @@ zfs_post_common(spa_t *spa, vdev_t *vd, const char *type, const char *name,
VERIFY0(nvlist_add_string(resource,
FM_EREPORT_PAYLOAD_ZFS_VDEV_ENC_SYSFS_PATH,
vd->vdev_enc_sysfs_path));
- /* also copy any optional payload data */
- if (aux) {
- nvpair_t *elem = NULL;
+ }
- while ((elem = nvlist_next_nvpair(aux, elem)) != NULL)
- (void) nvlist_add_nvpair(resource, elem);
- }
+ /* also copy any optional payload data */
+ if (aux) {
+ nvpair_t *elem = NULL;
+
+ while ((elem = nvlist_next_nvpair(aux, elem)) != NULL)
+ (void) nvlist_add_nvpair(resource, elem);
}
- zfs_zevent_post(resource, NULL, zfs_zevent_post_cb);
+#endif
+ return (resource);
+}
+
+static void
+zfs_post_common(spa_t *spa, vdev_t *vd, const char *type, const char *name,
+ nvlist_t *aux)
+{
+#ifdef _KERNEL
+ nvlist_t *resource;
+
+ resource = zfs_event_create(spa, vd, type, name, aux);
+ if (resource)
+ zfs_zevent_post(resource, NULL, zfs_zevent_post_cb);
#endif
}
@@ -1025,23 +1045,10 @@ zfs_post_state_change(spa_t *spa, vdev_t *vd, uint64_t laststate)
#endif
}
-/*
- * The 'sysevent.fs.zfs.*' events are signals posted to notify user space of
- * change in the pool. All sysevents are listed in sys/sysevent/eventdefs.h
- * and are designed to be consumed by the ZFS Event Daemon (ZED). For
- * additional details refer to the zed(8) man page.
- */
-void
-zfs_post_sysevent(spa_t *spa, vdev_t *vd, const char *name)
-{
- zfs_post_common(spa, vd, FM_SYSEVENT_CLASS, name, NULL);
-}
-
#if defined(_KERNEL) && defined(HAVE_SPL)
EXPORT_SYMBOL(zfs_ereport_post);
EXPORT_SYMBOL(zfs_ereport_post_checksum);
EXPORT_SYMBOL(zfs_post_remove);
EXPORT_SYMBOL(zfs_post_autoreplace);
EXPORT_SYMBOL(zfs_post_state_change);
-EXPORT_SYMBOL(zfs_post_sysevent);
#endif /* _KERNEL */