diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2023-03-06 16:27:46 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2023-03-13 15:40:41 +0400 |
commit | 78ae0e2613831909f1e553d45fae7925ade6c7f7 (patch) | |
tree | c143b0547bb50715771e439cf00b085f11e17e5c /monitor | |
parent | bf5de8c5d66552721fefe08de849c115ca366b56 (diff) | |
download | qemu-78ae0e2613831909f1e553d45fae7925ade6c7f7.zip qemu-78ae0e2613831909f1e553d45fae7925ade6c7f7.tar.gz qemu-78ae0e2613831909f1e553d45fae7925ade6c7f7.tar.bz2 |
monitor: release the lock before calling close()
As per comment, presumably to avoid syscall in critical section.
Fixes: 0210c3b39bef08 ("monitor: Use LOCK_GUARD macros")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230306122751.2355515-7-marcandre.lureau@redhat.com>
Diffstat (limited to 'monitor')
-rw-r--r-- | monitor/fds.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/monitor/fds.c b/monitor/fds.c index 26b39a0..7daf106 100644 --- a/monitor/fds.c +++ b/monitor/fds.c @@ -80,7 +80,8 @@ void qmp_getfd(const char *fdname, Error **errp) return; } - QEMU_LOCK_GUARD(&cur_mon->mon_lock); + /* See close() call below. */ + qemu_mutex_lock(&cur_mon->mon_lock); QLIST_FOREACH(monfd, &cur_mon->fds, next) { if (strcmp(monfd->name, fdname) != 0) { continue; @@ -88,6 +89,7 @@ void qmp_getfd(const char *fdname, Error **errp) tmp_fd = monfd->fd; monfd->fd = fd; + qemu_mutex_unlock(&cur_mon->mon_lock); /* Make sure close() is outside critical section */ close(tmp_fd); return; @@ -98,6 +100,7 @@ void qmp_getfd(const char *fdname, Error **errp) monfd->fd = fd; QLIST_INSERT_HEAD(&cur_mon->fds, monfd, next); + qemu_mutex_unlock(&cur_mon->mon_lock); } void qmp_closefd(const char *fdname, Error **errp) |