Project

General

Profile

Actions

Bug #14517

closed

bhyve EVF_VNODE mevent on plain file fires on every data change

Added by Andy Fiddaman 5 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

#14081 introduced support for EVF_VNODE mevents in bhyve, which are events that trigger when a file's metadata changes in some way. This is used to trigger resize events in various block device emulation pieces.

The FreeBSD implementation used kqueue with EVFILT_VNODE and NOTE_ATTRIB

    EVFILT_VNODE         Takes a file descriptor as the identifier and the
                         events to watch for in fflags, and returns when one
                         or more of the requested events occurs on the de-
                         scriptor.  The events to monitor are:

                         NOTE_ATTRIB          The file referenced by the de-
                                              scriptor had its attributes
                                              changed.

My illumos implementation used event ports with PORT_SOURCE_FILE and FILE_ATTRIB.
It has since become apparent that this fires for all writes to the backing file (since it watches for ctime changes)
, which is not ideal. However, most illumos bhyve VMs will be using ZFS volumes as backing storage for block
devices and, since those do not support event ports, they will be using the fallback polling method introduced in
#14374

There are tests, introduced with #14374, which check for proper operation with plain files, plain files unlinked from
the filesystem and ZFS volumes, but they failed to catch this problematic behaviour most of the time; run the plain
file test in a loop and it will eventually fail.

We should stop using event ports for this and use the polling mechanism in all cases, and also adjust the test
to properly check this.


Related issues

Related to illumos gate - Feature #14081: bhyve upstream sync 2021 SeptemberClosedAndy Fiddaman

Actions
Related to illumos gate - Feature #14374: Improve bhyve mevent EVF_VNODE monitoringClosedAndy Fiddaman

Actions
Actions #1

Updated by Andy Fiddaman 5 months ago

  • Related to Feature #14081: bhyve upstream sync 2021 September added
  • Related to Feature #14374: Improve bhyve mevent EVF_VNODE monitoring added
Actions #2

Updated by Electric Monk 5 months ago

  • Gerrit CR set to 2032
Actions #3

Updated by Andy Fiddaman 4 months ago

I've tested the associated change on gerrit through the mevent vnode tests:

% ./vnode_file
PASS vnode_file - temporary file
PASS vnode_file - anon file
PASS vnode_file
% pfexec ./vnode_zvol
PASS vnode_zvol

and also checking that a guest still receives an event when an NVMe disk is resized, whether that disk is backed by a zvol or a file.

Actions #4

Updated by Electric Monk 4 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit e8d712970f7ec76e09d5013b0b9aa5f0e0cf3e62

commit  e8d712970f7ec76e09d5013b0b9aa5f0e0cf3e62
Author: Andy Fiddaman <omnios@citrus-it.co.uk>
Date:   2022-03-16T00:03:11.000Z

    14517 bhyve EVF_VNODE mevent on plain file fires on every data change
    Reviewed by: Jason King <jason.brian.king+illumos@gmail.com>
    Reviewed by: Patrick Mooney <pmooney@pfmooney.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF