From patchwork Tue Sep 10 15:41:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Lieven X-Patchwork-Id: 11139797 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F0B616B1 for ; Tue, 10 Sep 2019 15:44:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3F8C22089F for ; Tue, 10 Sep 2019 15:44:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F8C22089F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kamp.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:41538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7iJD-0005Bp-GP for patchwork-qemu-devel@patchwork.kernel.org; Tue, 10 Sep 2019 11:43:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36164) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7iGZ-0002FQ-OE for qemu-devel@nongnu.org; Tue, 10 Sep 2019 11:41:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7iGY-0004RI-GT for qemu-devel@nongnu.org; Tue, 10 Sep 2019 11:41:15 -0400 Received: from kerio.kamp.de ([195.62.97.192]:60399) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i7iGY-0004Ps-3T for qemu-devel@nongnu.org; Tue, 10 Sep 2019 11:41:14 -0400 X-Footer: a2FtcC5kZQ== Received: from submission.kamp.de ([195.62.97.28]) by kerio.kamp.de with ESMTPS (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256 bits)) for qemu-devel@nongnu.org; Tue, 10 Sep 2019 17:41:08 +0200 Received: (qmail 7081 invoked from network); 10 Sep 2019 15:41:11 -0000 Received: from lieven-pc.kamp-intra.net (HELO lieven-pc) (relay@kamp.de@::ffff:172.21.12.60) by submission.kamp.de with ESMTPS (DHE-RSA-AES256-GCM-SHA384 encrypted) ESMTPA; 10 Sep 2019 15:41:11 -0000 Received: by lieven-pc (Postfix, from userid 1060) id 7A01813D850; Tue, 10 Sep 2019 17:41:11 +0200 (CEST) From: Peter Lieven To: qemu-block@nongnu.org Date: Tue, 10 Sep 2019 17:41:09 +0200 Message-Id: <20190910154110.6905-2-pl@kamp.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190910154110.6905-1-pl@kamp.de> References: <20190910154110.6905-1-pl@kamp.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.62.97.192 Subject: [Qemu-devel] [PATCH V2 1/2] block/nfs: tear down aio before nfs_close X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Peter Lieven , qemu-stable@nongnu.org, qemu-devel@nongnu.org, ronniesahlberg@gmail.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 --- 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; } From patchwork Tue Sep 10 15:41:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Lieven X-Patchwork-Id: 11139777 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3D33516B1 for ; Tue, 10 Sep 2019 15:42:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1DDCF2089F for ; Tue, 10 Sep 2019 15:42:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1DDCF2089F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kamp.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:41506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7iHh-0003XE-4r for patchwork-qemu-devel@patchwork.kernel.org; Tue, 10 Sep 2019 11:42:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36165) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7iGZ-0002FR-O2 for qemu-devel@nongnu.org; Tue, 10 Sep 2019 11:41:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7iGY-0004RD-H4 for qemu-devel@nongnu.org; Tue, 10 Sep 2019 11:41:15 -0400 Received: from kerio.kamp.de ([195.62.97.192]:60396) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i7iGY-0004Po-3W for qemu-devel@nongnu.org; Tue, 10 Sep 2019 11:41:14 -0400 X-Footer: a2FtcC5kZQ== Received: from submission.kamp.de ([195.62.97.28]) by kerio.kamp.de with ESMTPS (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256 bits)) for qemu-devel@nongnu.org; Tue, 10 Sep 2019 17:41:08 +0200 Received: (qmail 7082 invoked from network); 10 Sep 2019 15:41:11 -0000 Received: from lieven-pc.kamp-intra.net (HELO lieven-pc) (relay@kamp.de@::ffff:172.21.12.60) by submission.kamp.de with ESMTPS (DHE-RSA-AES256-GCM-SHA384 encrypted) ESMTPA; 10 Sep 2019 15:41:11 -0000 Received: by lieven-pc (Postfix, from userid 1060) id 7CF2813D878; Tue, 10 Sep 2019 17:41:11 +0200 (CEST) From: Peter Lieven To: qemu-block@nongnu.org Date: Tue, 10 Sep 2019 17:41:10 +0200 Message-Id: <20190910154110.6905-3-pl@kamp.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190910154110.6905-1-pl@kamp.de> References: <20190910154110.6905-1-pl@kamp.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.62.97.192 Subject: [Qemu-devel] [PATCH V2 2/2] block/nfs: add support for nfs_umount X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Peter Lieven , qemu-devel@nongnu.org, ronniesahlberg@gmail.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" libnfs recently added support for unmounting. Add support in Qemu too. Signed-off-by: Peter Lieven --- block/nfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/nfs.c b/block/nfs.c index 2c98508275..f39acfdb28 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -398,6 +398,9 @@ static void nfs_client_close(NFSClient *client) nfs_close(client->context, client->fh); client->fh = NULL; } +#ifdef LIBNFS_FEATURE_UMOUNT + nfs_umount(client->context); +#endif nfs_destroy_context(client->context); client->context = NULL; }