The branch main has been updated by asomers:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=92642bba4db4bf1719758ac7233468bc09a0bd59

commit 92642bba4db4bf1719758ac7233468bc09a0bd59
Author:     Alan Somers <asom...@freebsd.org>
AuthorDate: 2023-04-03 21:45:55 +0000
Commit:     Alan Somers <asom...@freebsd.org>
CommitDate: 2023-07-10 22:36:57 +0000

    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
---
 cddl/usr.sbin/zfsd/case_file.cc  |  6 +++---
 cddl/usr.sbin/zfsd/zfsd.cc       |  2 +-
 cddl/usr.sbin/zfsd/zfsd_event.cc | 10 +++++-----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/cddl/usr.sbin/zfsd/case_file.cc b/cddl/usr.sbin/zfsd/case_file.cc
index 5064d3c266dd..ef4d592b9602 100644
--- a/cddl/usr.sbin/zfsd/case_file.cc
+++ b/cddl/usr.sbin/zfsd/case_file.cc
@@ -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();
diff --git a/cddl/usr.sbin/zfsd/zfsd.cc b/cddl/usr.sbin/zfsd/zfsd.cc
index 29c6b1ae22e2..16c02203b66b 100644
--- a/cddl/usr.sbin/zfsd/zfsd.cc
+++ b/cddl/usr.sbin/zfsd/zfsd.cc
@@ -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) {
diff --git a/cddl/usr.sbin/zfsd/zfsd_event.cc b/cddl/usr.sbin/zfsd/zfsd_event.cc
index 45fc7adbb31b..5391aeb2997f 100644
--- a/cddl/usr.sbin/zfsd/zfsd_event.cc
+++ b/cddl/usr.sbin/zfsd/zfsd_event.cc
@@ -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. */

Reply via email to