From nobody Wed Nov 5 09:21:56 2025 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1502295093860444.12650188139264; Wed, 9 Aug 2017 09:11:33 -0700 (PDT) Received: from localhost ([::1]:48822 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfTa0-0001O4-MP for importer@patchew.org; Wed, 09 Aug 2017 12:11:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfTRH-0002gK-Qn for qemu-devel@nongnu.org; Wed, 09 Aug 2017 12:02:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dfTRG-0007K8-TP for qemu-devel@nongnu.org; Wed, 09 Aug 2017 12:02:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42820) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dfTRE-0007J1-Dm; Wed, 09 Aug 2017 12:02:28 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 51139C04E523; Wed, 9 Aug 2017 16:02:27 +0000 (UTC) Received: from localhost (ovpn-116-128.ams2.redhat.com [10.36.116.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id B87F57E5DA; Wed, 9 Aug 2017 16:02:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 51139C04E523 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=stefanha@redhat.com From: Stefan Hajnoczi To: Date: Wed, 9 Aug 2017 17:02:11 +0100 Message-Id: <20170809160212.29976-2-stefanha@redhat.com> In-Reply-To: <20170809160212.29976-1-stefanha@redhat.com> References: <20170809160212.29976-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 09 Aug 2017 16:02:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/2] 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 , qemu-block@nongnu.org, "Dr . David Alan Gilbert" , P J P , Stefan Hajnoczi , Paolo Bonzini , John Snow 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" The block backend changed in a way that flushing empty CDROM drives now crashes. Amend IDE to avoid doing so until the root problem can be addressed for 2.11. Original patch by John Snow . Reported-by: Kieron Shorrock Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake --- hw/ide/core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index 0b48b64d3a..bea39536b0 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -1063,7 +1063,15 @@ 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); - s->pio_aiocb =3D blk_aio_flush(s->blk, ide_flush_cb, s); + + 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); + } } =20 static void ide_cfata_metadata_inquiry(IDEState *s) --=20 2.13.3