diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2022-02-01 19:48:15 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2022-02-01 19:48:15 +0000 |
| commit | 47cc1a3655135b89fa75c2824fbddd29df874612 (patch) | |
| tree | 84dacddc6f41dd0dd2af33fec28eb2f4b255e095 /util/vhost-user-server.c | |
| parent | 3bbe296c1c7a6ddce7a294e006b8c4a53b385292 (diff) | |
| parent | fc176116cdea816ceb8dd969080b2b95f58edbc0 (diff) | |
| download | focaccia-qemu-47cc1a3655135b89fa75c2824fbddd29df874612.tar.gz focaccia-qemu-47cc1a3655135b89fa75c2824fbddd29df874612.zip | |
Merge remote-tracking branch 'remotes/kwolf-gitlab/tags/for-upstream' into staging
Block layer patches - rbd: fix handling of holes in .bdrv_co_block_status - Fix potential crash in bdrv_set_backing_hd() - vhost-user-blk export: Fix shutdown with requests in flight - FUSE export: Fix build failure on FreeBSD - Documentation improvements # gpg: Signature made Tue 01 Feb 2022 15:14:24 GMT # gpg: using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6 # gpg: issuer "kwolf@redhat.com" # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full] # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kwolf-gitlab/tags/for-upstream: block/rbd: workaround for ceph issue #53784 block/rbd: fix handling of holes in .bdrv_co_block_status qemu-img: Unify [-b [-F]] documentation qsd: Document fuse's allow-other option block.h: remove outdated comment block/export/fuse: Fix build failure on FreeBSD block/export/fuse: Rearrange if-else-if ladder in fuse_fallocate() block/export: Fix vhost-user-blk shutdown with requests in flight block: bdrv_set_backing_hd(): use drained section qemu-storage-daemon: Fix typo in vhost-user-blk help Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util/vhost-user-server.c')
| -rw-r--r-- | util/vhost-user-server.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/util/vhost-user-server.c b/util/vhost-user-server.c index f68287e811..f66fbba710 100644 --- a/util/vhost-user-server.c +++ b/util/vhost-user-server.c @@ -74,6 +74,20 @@ static void panic_cb(VuDev *vu_dev, const char *buf) error_report("vu_panic: %s", buf); } +void vhost_user_server_ref(VuServer *server) +{ + assert(!server->wait_idle); + server->refcount++; +} + +void vhost_user_server_unref(VuServer *server) +{ + server->refcount--; + if (server->wait_idle && !server->refcount) { + aio_co_wake(server->co_trip); + } +} + static bool coroutine_fn vu_message_read(VuDev *vu_dev, int conn_fd, VhostUserMsg *vmsg) { @@ -177,6 +191,14 @@ static coroutine_fn void vu_client_trip(void *opaque) /* Keep running */ } + if (server->refcount) { + /* Wait for requests to complete before we can unmap the memory */ + server->wait_idle = true; + qemu_coroutine_yield(); + server->wait_idle = false; + } + assert(server->refcount == 0); + vu_deinit(vu_dev); /* vu_deinit() should have called remove_watch() */ |