summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPeter Lieven <pl@kamp.de>2019-09-10 17:41:09 +0200
committerKevin Wolf <kwolf@redhat.com>2019-09-13 12:18:14 +0200
commit601dc6559725f7a614b6f893611e17ff0908e914 (patch)
tree2e9b129e2b92bd75e845811145d15a22b5e6acd3
parentd885ac33cfc30a14e0f68c227865910257fd2c44 (diff)
downloadfocaccia-qemu-601dc6559725f7a614b6f893611e17ff0908e914.tar.gz
focaccia-qemu-601dc6559725f7a614b6f893611e17ff0908e914.zip
block/nfs: tear down aio before nfs_close
nfs_close is a sync call from libnfs and has its own event
handler polling on the nfs FD. Avoid that both QEMU and libnfs
are intefering here.

CC: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block/nfs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/block/nfs.c b/block/nfs.c
index 0ec50953e4..2c98508275 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -390,12 +390,14 @@ static void nfs_attach_aio_context(BlockDriverState *bs,
 static void nfs_client_close(NFSClient *client)
 {
     if (client->context) {
+        qemu_mutex_lock(&client->mutex);
+        aio_set_fd_handler(client->aio_context, nfs_get_fd(client->context),
+                           false, NULL, NULL, NULL, NULL);
+        qemu_mutex_unlock(&client->mutex);
         if (client->fh) {
             nfs_close(client->context, client->fh);
             client->fh = NULL;
         }
-        aio_set_fd_handler(client->aio_context, nfs_get_fd(client->context),
-                           false, NULL, NULL, NULL, NULL);
         nfs_destroy_context(client->context);
         client->context = NULL;
     }