From patchwork Thu Apr 4 13:20:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 10885617 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EADC117EE for ; Thu, 4 Apr 2019 13:22:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D56F1286C0 for ; Thu, 4 Apr 2019 13:22:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C98C6286D6; Thu, 4 Apr 2019 13:22:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8561D286C0 for ; Thu, 4 Apr 2019 13:22:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729878AbfDDNWY (ORCPT ); Thu, 4 Apr 2019 09:22:24 -0400 Received: from foss.arm.com ([217.140.101.70]:60238 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729828AbfDDNWX (ORCPT ); Thu, 4 Apr 2019 09:22:23 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7368316A3; Thu, 4 Apr 2019 06:22:23 -0700 (PDT) Received: from ostrya.cambridge.arm.com (ostrya.cambridge.arm.com [10.1.196.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A25253F68F; Thu, 4 Apr 2019 06:22:22 -0700 (PDT) From: Jean-Philippe Brucker To: Will.Deacon@arm.com Cc: Andre.Przywara@arm.com, kvm@vger.kernel.org Subject: [PATCH kvmtool v2 9/9] virtio/blk: sync I/O on reset Date: Thu, 4 Apr 2019 14:20:50 +0100 Message-Id: <20190404132050.37309-10-jean-philippe.brucker@arm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404132050.37309-1-jean-philippe.brucker@arm.com> References: <20190404132050.37309-1-jean-philippe.brucker@arm.com> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ensure that all requests are complete when resetting a virtqueue, by draining the AIO queue after stopping the submission thread. Signed-off-by: Jean-Philippe Brucker --- virtio/blk.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/virtio/blk.c b/virtio/blk.c index 6e7a1ee36..50db6f5fc 100644 --- a/virtio/blk.c +++ b/virtio/blk.c @@ -248,6 +248,8 @@ static void exit_vq(struct kvm *kvm, void *dev, u32 vq) close(bdev->io_efd); pthread_cancel(bdev->io_thread); pthread_join(bdev->io_thread, NULL); + + disk_image__wait(bdev->disk); } static int notify_vq(struct kvm *kvm, void *dev, u32 vq)