qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Lieven <pl@kamp.de>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, Peter Lieven <pl@kamp.de>,
	qemu-stable@nongnu.org, qemu-devel@nongnu.org,
	ronniesahlberg@gmail.com, mreitz@redhat.com
Subject: [Qemu-devel] [PATCH V2 1/2] block/nfs: tear down aio before nfs_close
Date: Tue, 10 Sep 2019 17:41:09 +0200	[thread overview]
Message-ID: <20190910154110.6905-2-pl@kamp.de> (raw)
In-Reply-To: <20190910154110.6905-1-pl@kamp.de>

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>
---
 block/nfs.c | 6 ++++--
 1 file 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;
     }
-- 
2.17.1




  reply	other threads:[~2019-09-10 15:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-10 15:41 [Qemu-devel] [PATCH V2 0/2] add support for nfs_umount Peter Lieven
2019-09-10 15:41 ` Peter Lieven [this message]
2019-09-13  9:51   ` [Qemu-devel] [PATCH V2 1/2] block/nfs: tear down aio before nfs_close Max Reitz
2019-09-13 10:15     ` Peter Lieven
2019-09-13 10:21     ` Kevin Wolf
2019-09-10 15:41 ` [Qemu-devel] [PATCH V2 2/2] block/nfs: add support for nfs_umount Peter Lieven
2019-09-11  7:48   ` Max Reitz
2019-09-11 12:22     ` Peter Lieven
2019-09-13 10:09     ` ronnie sahlberg
2019-09-13 11:13       ` Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190910154110.6905-2-pl@kamp.de \
    --to=pl@kamp.de \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=ronniesahlberg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).