git: d3cc82c9b7aa - stable/13 - bhyve: set EV_CLEAR for EVFILT_VNODE mevents

From: Robert Wing <rew_at_FreeBSD.org>
Date: Thu, 17 Feb 2022 22:01:40 UTC
The branch stable/13 has been updated by rew:

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

commit d3cc82c9b7aa08ee3643dfd39c6c51250844cdc8
Author:     Robert Wing <rew@FreeBSD.org>
AuthorDate: 2021-12-12 21:39:40 +0000
Commit:     Robert Wing <rew@FreeBSD.org>
CommitDate: 2022-02-17 21:35:19 +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
    
    (cherry picked from commit 0b29683b32df0233a85f597836e61cc6432a3e4f)
---
 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 0c5351cd31a9..e12a46ac9312 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