zfsd: listen for sysevent.fs.zfs instead of misc.fs.zfs

At some point the names of these devd events changed.  Probably it
happened when importing OpenZFS.  Before that, FreeBSD's sysevent_alloc
method didn't create a "class" nvpair in the event, which led to
log_sysevent using the event's ev_subclass field as its type.

MFC after:	2 weeks
Sponsored by:	Axcient
Differential Revision: https://reviews.freebsd.org/D39437
This commit is contained in:
Alan Somers 2023-04-03 15:45:55 -06:00
parent 7acb53817f
commit 92642bba4d
3 changed files with 9 additions and 9 deletions

View file

@ -388,7 +388,7 @@ CaseFile::ReEvaluate(const ZfsEvent &event)
{
bool consumed(false);
if (event.Value("type") == "misc.fs.zfs.vdev_remove") {
if (event.Value("type") == "sysevent.fs.zfs.vdev_remove") {
/*
* The Vdev we represent has been removed from the
* configuration. This case is no longer of value.
@ -396,12 +396,12 @@ CaseFile::ReEvaluate(const ZfsEvent &event)
Close();
return (/*consumed*/true);
} else if (event.Value("type") == "misc.fs.zfs.pool_destroy") {
} else if (event.Value("type") == "sysevent.fs.zfs.pool_destroy") {
/* This Pool has been destroyed. Discard the case */
Close();
return (/*consumed*/true);
} else if (event.Value("type") == "misc.fs.zfs.config_sync") {
} else if (event.Value("type") == "sysevent.fs.zfs.config_sync") {
RefreshVdevState();
if (VdevState() < VDEV_STATE_HEALTHY)
consumed = ActivateSpare();

View file

@ -248,7 +248,7 @@ ZfsDaemon::BuildCaseFiles()
snprintf(evString, 160, "!system=ZFS subsystem=ZFS "
"type=misc.fs.zfs.config_sync sub_type=synthesized "
"type=sysevent.fs.zfs.config_sync sub_type=synthesized "
"pool_name=%s pool_guid=%" PRIu64 "\n", poolname, poolGUID);
event = Event::CreateEvent(GetFactory(), string(evString));
if (event != NULL) {

View file

@ -285,7 +285,7 @@ ZfsEvent::Process() const
}
/* On config syncs, replay any queued events first. */
if (Value("type").find("misc.fs.zfs.config_sync") == 0) {
if (Value("type").find("sysevent.fs.zfs.config_sync") == 0) {
/*
* Even if saved events are unconsumed the second time
* around, drop them. Any events that still can't be
@ -296,7 +296,7 @@ ZfsEvent::Process() const
CaseFile::ReEvaluateByGuid(PoolGUID(), *this);
}
if (Value("type").find("misc.fs.zfs.") == 0) {
if (Value("type").find("sysevent.fs.zfs.") == 0) {
/* Configuration changes, resilver events, etc. */
ProcessPoolEvent();
return (false);
@ -409,7 +409,7 @@ ZfsEvent::ProcessPoolEvent() const
bool degradedDevice(false);
/* The pool is destroyed. Discard any open cases */
if (Value("type") == "misc.fs.zfs.pool_destroy") {
if (Value("type") == "sysevent.fs.zfs.pool_destroy") {
Log(LOG_INFO);
CaseFile::ReEvaluateByGuid(PoolGUID(), *this);
return;
@ -424,7 +424,7 @@ ZfsEvent::ProcessPoolEvent() const
Log(LOG_INFO);
caseFile->ReEvaluate(*this);
}
else if (Value("type") == "misc.fs.zfs.resilver_finish")
else if (Value("type") == "sysevent.fs.zfs.resilver_finish")
{
/*
* It's possible to get a resilver_finish event with no
@ -435,7 +435,7 @@ ZfsEvent::ProcessPoolEvent() const
CleanupSpares();
}
if (Value("type") == "misc.fs.zfs.vdev_remove"
if (Value("type") == "sysevent.fs.zfs.vdev_remove"
&& degradedDevice == false) {
/* See if any other cases can make use of this device. */