[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v3 25/30] monitor: Honor QMP request for fd removal immediate
|
From: |
Fabiano Rosas |
|
Subject: |
[RFC PATCH v3 25/30] monitor: Honor QMP request for fd removal immediately |
|
Date: |
Mon, 27 Nov 2023 17:26:07 -0300 |
We're currently only removing an fd from the fdset if the VM is
running. This causes a QMP call to "remove-fd" to not actually remove
the fd if the VM happens to be stopped.
While the fd would eventually be removed when monitor_fdset_cleanup()
is called again, the user request should be honored and the fd
actually removed. Calling remove-fd + query-fdset shows a recently
removed fd still present.
The runstate_is_running() check was introduced by commit ebe52b592d
("monitor: Prevent removing fd from set during init"), which by the
shortlog indicates that they were trying to avoid removing an
yet-unduplicated fd too early.
I don't see why an fd explicitly removed with qmp_remove_fd() should
be under runstate_is_running(). I'm assuming this was a mistake when
adding the parenthesis around the expression.
Move the runstate_is_running() check to apply only to the
QLIST_EMPTY(dup_fds) side of the expression and ignore it when
mon_fdset_fd->removed has been explicitly set.
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
monitor/fds.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/monitor/fds.c b/monitor/fds.c
index d86c2c674c..4ec3b7eea9 100644
--- a/monitor/fds.c
+++ b/monitor/fds.c
@@ -173,9 +173,9 @@ static void monitor_fdset_cleanup(MonFdset *mon_fdset)
MonFdsetFd *mon_fdset_fd_next;
QLIST_FOREACH_SAFE(mon_fdset_fd, &mon_fdset->fds, next, mon_fdset_fd_next)
{
- if ((mon_fdset_fd->removed ||
- (QLIST_EMPTY(&mon_fdset->dup_fds) && mon_refcount == 0)) &&
- runstate_is_running()) {
+ if (mon_fdset_fd->removed ||
+ (QLIST_EMPTY(&mon_fdset->dup_fds) && mon_refcount == 0 &&
+ runstate_is_running())) {
close(mon_fdset_fd->fd);
g_free(mon_fdset_fd->opaque);
QLIST_REMOVE(mon_fdset_fd, next);
--
2.35.3
- [RFC PATCH v3 15/30] io: Add a pwritev/preadv version that takes a discontiguous iovec, (continued)
- [RFC PATCH v3 15/30] io: Add a pwritev/preadv version that takes a discontiguous iovec, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 16/30] multifd: Rename MultiFDSendParams::data to compress_data, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 17/30] migration/multifd: Decouple recv method from pages, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 18/30] migration/multifd: Allow receiving pages without packets, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 19/30] migration/ram: Ignore multifd flush when doing fixed-ram migration, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 20/30] migration/multifd: Support outgoing fixed-ram stream format, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 21/30] migration/multifd: Support incoming fixed-ram stream format, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 22/30] tests/qtest: Add a multifd + fixed-ram migration test, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 23/30] migration: Add direct-io parameter, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 24/30] tests/qtest: Add a test for migration with direct-io and multifd, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 25/30] monitor: Honor QMP request for fd removal immediately,
Fabiano Rosas <=
- [RFC PATCH v3 26/30] monitor: Extract fdset fd flags comparison into a function, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 27/30] monitor: fdset: Match against O_DIRECT, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 28/30] docs/devel/migration.rst: Document the file transport, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 30/30] tests/qtest: Add a test for fixed-ram with passing of fds, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 29/30] migration: Add support for fdset with multifd + file, Fabiano Rosas, 2023/11/27