From nobody Sat May 4 10:40:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518110725996997.0099049973799; Thu, 8 Feb 2018 09:25:25 -0800 (PST) Received: from localhost ([::1]:54995 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejpwn-0005Jd-2B for importer@patchew.org; Thu, 08 Feb 2018 12:25:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejpqA-0007j4-BN for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:18:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejpq6-0003bZ-8e for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:18:30 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55426 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ejpq6-0003VL-2Q for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:18:26 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1C319BA56; Thu, 8 Feb 2018 17:18:19 +0000 (UTC) Received: from localhost (unknown [10.36.118.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DE19B07AF; Thu, 8 Feb 2018 17:18:14 +0000 (UTC) From: Stefan Hajnoczi To: Date: Thu, 8 Feb 2018 17:18:05 +0000 Message-Id: <20180208171807.24267-2-stefanha@redhat.com> In-Reply-To: <20180208171807.24267-1-stefanha@redhat.com> References: <20180208171807.24267-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Feb 2018 17:18:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Feb 2018 17:18:19 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'stefanha@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 1/3] block: add BlockBackend->in_flight counter X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" BlockBackend currently relies on BlockDriverState->in_flight to track requests for blk_drain(). There is a corner case where BlockDriverState->in_flight cannot be used though: blk->root can be NULL when there is no medium. This results in a segfault when the NULL pointer is dereferenced. Introduce a BlockBackend->in_flight counter for aio requests so it works even when blk->root =3D=3D NULL. Based on a patch by Kevin Wolf . Signed-off-by: Kevin Wolf Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Tested-by: Eric Blake --- block.c | 2 +- block/block-backend.c | 59 +++++++++++++++++++++++++++++++++++++++++++++--= ---- 2 files changed, 53 insertions(+), 8 deletions(-) diff --git a/block.c b/block.c index a8da4f2b25..140f7919f8 100644 --- a/block.c +++ b/block.c @@ -4716,7 +4716,7 @@ out: =20 AioContext *bdrv_get_aio_context(BlockDriverState *bs) { - return bs->aio_context; + return bs ? bs->aio_context : qemu_get_aio_context(); } =20 void bdrv_coroutine_enter(BlockDriverState *bs, Coroutine *co) diff --git a/block/block-backend.c b/block/block-backend.c index baef8e7abc..4811d8bc55 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -71,6 +71,13 @@ struct BlockBackend { int quiesce_counter; VMChangeStateEntry *vmsh; bool force_allow_inactivate; + + /* Number of in-flight aio requests. BlockDriverState also counts + * in-flight requests but aio requests can exist even when blk->root is + * NULL, so we cannot rely on its counter for that case. + * Accessed with atomic ops. + */ + unsigned int in_flight; }; =20 typedef struct BlockBackendAIOCB { @@ -1223,11 +1230,21 @@ int blk_make_zero(BlockBackend *blk, BdrvRequestFla= gs flags) return bdrv_make_zero(blk->root, flags); } =20 +static void blk_inc_in_flight(BlockBackend *blk) +{ + atomic_inc(&blk->in_flight); +} + +static void blk_dec_in_flight(BlockBackend *blk) +{ + atomic_dec(&blk->in_flight); +} + static void error_callback_bh(void *opaque) { struct BlockBackendAIOCB *acb =3D opaque; =20 - bdrv_dec_in_flight(acb->common.bs); + blk_dec_in_flight(acb->blk); acb->common.cb(acb->common.opaque, acb->ret); qemu_aio_unref(acb); } @@ -1238,7 +1255,7 @@ BlockAIOCB *blk_abort_aio_request(BlockBackend *blk, { struct BlockBackendAIOCB *acb; =20 - bdrv_inc_in_flight(blk_bs(blk)); + blk_inc_in_flight(blk); acb =3D blk_aio_get(&block_backend_aiocb_info, blk, cb, opaque); acb->blk =3D blk; acb->ret =3D ret; @@ -1261,7 +1278,7 @@ static const AIOCBInfo blk_aio_em_aiocb_info =3D { static void blk_aio_complete(BlkAioEmAIOCB *acb) { if (acb->has_returned) { - bdrv_dec_in_flight(acb->common.bs); + blk_dec_in_flight(acb->rwco.blk); acb->common.cb(acb->common.opaque, acb->rwco.ret); qemu_aio_unref(acb); } @@ -1282,7 +1299,7 @@ static BlockAIOCB *blk_aio_prwv(BlockBackend *blk, in= t64_t offset, int bytes, BlkAioEmAIOCB *acb; Coroutine *co; =20 - bdrv_inc_in_flight(blk_bs(blk)); + blk_inc_in_flight(blk); acb =3D blk_aio_get(&blk_aio_em_aiocb_info, blk, cb, opaque); acb->rwco =3D (BlkRwCo) { .blk =3D blk, @@ -1519,14 +1536,42 @@ int blk_flush(BlockBackend *blk) =20 void blk_drain(BlockBackend *blk) { - if (blk_bs(blk)) { - bdrv_drain(blk_bs(blk)); + BlockDriverState *bs =3D blk_bs(blk); + + if (bs) { + bdrv_drained_begin(bs); + } + + /* We may have aio requests like -ENOMEDIUM in flight */ + while (atomic_mb_read(&blk->in_flight) > 0) { + aio_poll(blk_get_aio_context(blk), true); + } + + if (bs) { + bdrv_drained_end(bs); } } =20 void blk_drain_all(void) { - bdrv_drain_all(); + BlockBackend *blk =3D NULL; + + bdrv_drain_all_begin(); + + while ((blk =3D blk_all_next(blk)) !=3D NULL) { + AioContext *ctx =3D blk_get_aio_context(blk); + + aio_context_acquire(ctx); + + /* We may have aio requests like -ENOMEDIUM in flight */ + while (atomic_mb_read(&blk->in_flight) > 0) { + aio_poll(blk_get_aio_context(blk), true); + } + + aio_context_release(ctx); + } + + bdrv_drain_all_end(); } =20 void blk_set_on_error(BlockBackend *blk, BlockdevOnError on_read_error, --=20 2.14.3 From nobody Sat May 4 10:40:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 15181105379241.9283093683217203; Thu, 8 Feb 2018 09:22:17 -0800 (PST) Received: from localhost ([::1]:54541 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejptj-0002Dm-Lj for importer@patchew.org; Thu, 08 Feb 2018 12:22:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejpqA-0007j3-Ay for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:18:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejpq8-0003dY-F1 for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:18:30 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55428 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ejpq8-0003XC-9Y for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:18:28 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B9B1EAE9C; Thu, 8 Feb 2018 17:18:22 +0000 (UTC) Received: from localhost (unknown [10.36.118.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7B592166BAE; Thu, 8 Feb 2018 17:18:21 +0000 (UTC) From: Stefan Hajnoczi To: Date: Thu, 8 Feb 2018 17:18:06 +0000 Message-Id: <20180208171807.24267-3-stefanha@redhat.com> In-Reply-To: <20180208171807.24267-1-stefanha@redhat.com> References: <20180208171807.24267-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Feb 2018 17:18:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Feb 2018 17:18:22 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'stefanha@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 2/3] block: test blk_aio_flush() with blk->root == NULL X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Kevin Wolf This patch adds test cases for the scenario where blk_aio_flush() is called on a BlockBackend with no root. Calling drain afterwards should complete the requests with -ENOMEDIUM. Signed-off-by: Kevin Wolf Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Tested-by: Eric Blake --- tests/Makefile.include | 2 ++ tests/test-block-backend.c | 82 ++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 84 insertions(+) create mode 100644 tests/test-block-backend.c diff --git a/tests/Makefile.include b/tests/Makefile.include index f41da235ae..1a457c29bc 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -83,6 +83,7 @@ gcov-files-test-hbitmap-y =3D blockjob.c check-unit-y +=3D tests/test-bdrv-drain$(EXESUF) check-unit-y +=3D tests/test-blockjob$(EXESUF) check-unit-y +=3D tests/test-blockjob-txn$(EXESUF) +check-unit-y +=3D tests/test-block-backend$(EXESUF) check-unit-y +=3D tests/test-x86-cpuid$(EXESUF) # all code tested by test-x86-cpuid is inside topology.h gcov-files-test-x86-cpuid-y =3D @@ -609,6 +610,7 @@ tests/test-throttle$(EXESUF): tests/test-throttle.o $(t= est-block-obj-y) tests/test-bdrv-drain$(EXESUF): tests/test-bdrv-drain.o $(test-block-obj-y= ) $(test-util-obj-y) tests/test-blockjob$(EXESUF): tests/test-blockjob.o $(test-block-obj-y) $(= test-util-obj-y) tests/test-blockjob-txn$(EXESUF): tests/test-blockjob-txn.o $(test-block-o= bj-y) $(test-util-obj-y) +tests/test-block-backend$(EXESUF): tests/test-block-backend.o $(test-block= -obj-y) $(test-util-obj-y) tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(test-block-obj= -y) tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y) tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y) $(tes= t-crypto-obj-y) diff --git a/tests/test-block-backend.c b/tests/test-block-backend.c new file mode 100644 index 0000000000..fd59f02bd0 --- /dev/null +++ b/tests/test-block-backend.c @@ -0,0 +1,82 @@ +/* + * BlockBackend tests + * + * Copyright (c) 2017 Kevin Wolf + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include "block/block.h" +#include "sysemu/block-backend.h" +#include "qapi/error.h" + +static void test_drain_aio_error_flush_cb(void *opaque, int ret) +{ + bool *completed =3D opaque; + + g_assert(ret =3D=3D -ENOMEDIUM); + *completed =3D true; +} + +static void test_drain_aio_error(void) +{ + BlockBackend *blk =3D blk_new(BLK_PERM_ALL, BLK_PERM_ALL); + BlockAIOCB *acb; + bool completed =3D false; + + acb =3D blk_aio_flush(blk, test_drain_aio_error_flush_cb, &completed); + g_assert(acb !=3D NULL); + g_assert(completed =3D=3D false); + + blk_drain(blk); + g_assert(completed =3D=3D true); + + blk_unref(blk); +} + +static void test_drain_all_aio_error(void) +{ + BlockBackend *blk =3D blk_new(BLK_PERM_ALL, BLK_PERM_ALL); + BlockAIOCB *acb; + bool completed =3D false; + + acb =3D blk_aio_flush(blk, test_drain_aio_error_flush_cb, &completed); + g_assert(acb !=3D NULL); + g_assert(completed =3D=3D false); + + blk_drain_all(); + g_assert(completed =3D=3D true); + + blk_unref(blk); +} + +int main(int argc, char **argv) +{ + bdrv_init(); + qemu_init_main_loop(&error_abort); + + g_test_init(&argc, &argv, NULL); + + g_test_add_func("/block-backend/drain_aio_error", test_drain_aio_error= ); + g_test_add_func("/block-backend/drain_all_aio_error", + test_drain_all_aio_error); + + return g_test_run(); +} --=20 2.14.3 From nobody Sat May 4 10:40:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518111624054466.55891084246366; Thu, 8 Feb 2018 09:40:24 -0800 (PST) Received: from localhost ([::1]:56895 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejqBL-00028p-5d for importer@patchew.org; Thu, 08 Feb 2018 12:40:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejpqA-0007jo-PJ for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:18:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejpq9-0003eR-VD for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:18:30 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48904 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ejpq9-0003Yi-Q8 for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:18:29 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1E7137D824; Thu, 8 Feb 2018 17:18:24 +0000 (UTC) Received: from localhost (unknown [10.36.118.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id C169B2026609; Thu, 8 Feb 2018 17:18:23 +0000 (UTC) From: Stefan Hajnoczi To: Date: Thu, 8 Feb 2018 17:18:07 +0000 Message-Id: <20180208171807.24267-4-stefanha@redhat.com> In-Reply-To: <20180208171807.24267-1-stefanha@redhat.com> References: <20180208171807.24267-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 08 Feb 2018 17:18:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 08 Feb 2018 17:18:24 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'stefanha@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 3/3] Revert "IDE: Do not flush empty CDROM drives" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This reverts commit 4da97120d51a4383aa96d741a2b837f8c4bbcd0b. blk_aio_flush() now handles the blk->root =3D=3D NULL case, so we no longer need this workaround. Cc: John Snow Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Tested-by: Eric Blake --- hw/ide/core.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index 5be72d41dc..6154bc6ad7 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -1085,15 +1085,7 @@ static void ide_flush_cache(IDEState *s) s->status |=3D BUSY_STAT; ide_set_retry(s); block_acct_start(blk_get_stats(s->blk), &s->acct, 0, BLOCK_ACCT_FLUSH); - - if (blk_bs(s->blk)) { - s->pio_aiocb =3D blk_aio_flush(s->blk, ide_flush_cb, s); - } else { - /* XXX blk_aio_flush() crashes when blk_bs(blk) is NULL, remove th= is - * temporary workaround when blk_aio_*() functions handle NULL blk= _bs. - */ - ide_flush_cb(s, 0); - } + s->pio_aiocb =3D blk_aio_flush(s->blk, ide_flush_cb, s); } =20 static void ide_cfata_metadata_inquiry(IDEState *s) --=20 2.14.3