qemuDomainRemoveChrDevice: Detach fdset after chardev hot-unplug

Our code uses fdsets for the pipe passed from virtlogd to qemu, but the
chardev hot-unplug code neglected to detach the fdset after the chardev
was removed. This kept the FDs open by qemu even after they were not
used any more.

After the refactor to use qemuFDPass for chardevs we now configure the
'opaque' field for fdsets used for chardevs so we can use
qemuHotplugRemoveFDSet to remove the unused fdset.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-02-03 10:35:03 +01:00
parent 6d161bcc60
commit 22d5ce0252
2 changed files with 3 additions and 2 deletions

View File

@ -4881,6 +4881,7 @@ qemuDomainRemoveChrDevice(virQEMUDriver *driver,
if (monitor) {
qemuDomainObjEnterMonitor(driver, vm);
rc = qemuMonitorDetachCharDev(priv->mon, charAlias);
qemuHotplugRemoveFDSet(priv->mon, chr->info.alias, NULL);
qemuDomainObjExitMonitor(driver, vm);
}

View File

@ -708,7 +708,7 @@ mymain(void)
DO_TEST_DETACH("console-compat-2-live", "console-virtio", false, false,
"device_del", QMP_DEVICE_DELETED("console1") QMP_OK,
"chardev-remove", QMP_OK);
"chardev-remove", QMP_OK, "query-fdsets", "{\"return\": []}");
DO_TEST_ATTACH("base-live", "disk-virtio", false, true,
"human-monitor-command", HMP("OK\\r\\n"),
@ -768,7 +768,7 @@ mymain(void)
"device_add", QMP_OK);
DO_TEST_DETACH("base-live", "qemu-agent-detach", false, false,
"device_del", QMP_DEVICE_DELETED("channel0") QMP_OK,
"chardev-remove", QMP_OK);
"chardev-remove", QMP_OK, "query-fdsets", "{\"return\": []}");
DO_TEST_ATTACH("base-ccw-live", "ccw-virtio", false, true,
"human-monitor-command", HMP("OK\\r\\n"),