git: 0b29683b32df - main - bhyve: set EV_CLEAR for EVFILT_VNODE mevents

From: Robert Wing <rew_at_FreeBSD.org>
Date: Sun, 12 Dec 2021 21:49:54 UTC
The branch main has been updated by rew:

URL: https://cgit.FreeBSD.org/src/commit/?id=0b29683b32df0233a85f597836e61cc6432a3e4f

commit 0b29683b32df0233a85f597836e61cc6432a3e4f
Author:     Robert Wing <rew@FreeBSD.org>
AuthorDate: 2021-12-12 21:39:40 +0000
Commit:     Robert Wing <rew@FreeBSD.org>
CommitDate: 2021-12-12 21:39:40 +0000

    bhyve: set EV_CLEAR for EVFILT_VNODE mevents
    
    When an EVFILT_VNODE filter event is triggered, reset it.
    
    This fixes the issue where a virtio-blk resize event would cause the
    mevent thread to consume 100% of the cpu.
    
    Reviewed by:    jhb
    Differential Revision:  https://reviews.freebsd.org/D33326
---
 usr.sbin/bhyve/mevent.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/bhyve/mevent.c b/usr.sbin/bhyve/mevent.c
index eb84dc15ad47..5170251e008b 100644
--- a/usr.sbin/bhyve/mevent.c
+++ b/usr.sbin/bhyve/mevent.c
@@ -175,7 +175,14 @@ mevent_kq_filter(struct mevent *mevp)
 static int
 mevent_kq_flags(struct mevent *mevp)
 {
-	return (mevp->me_state);
+	int retval;
+
+	retval = mevp->me_state;
+
+	if (mevp->me_type == EVF_VNODE)
+		retval |= EV_CLEAR;
+
+	return (retval);
 }
 
 static int