From patchwork Thu Aug 10 17:48:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 800303 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xSwj913Qlz9s82 for ; Fri, 11 Aug 2017 03:53:17 +1000 (AEST) Received: from localhost ([::1]:54528 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfrdz-0001Rw-2y for incoming@patchwork.ozlabs.org; Thu, 10 Aug 2017 13:53:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfrbC-00088l-8M for qemu-devel@nongnu.org; Thu, 10 Aug 2017 13:50:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dfrbA-0004WR-Sl for qemu-devel@nongnu.org; Thu, 10 Aug 2017 13:50:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60024) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dfrbA-0004UZ-MX for qemu-devel@nongnu.org; Thu, 10 Aug 2017 13:50:20 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9794F4B95; Thu, 10 Aug 2017 17:50:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9794F4B95 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=stefanha@redhat.com Received: from localhost (ovpn-116-36.ams2.redhat.com [10.36.116.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B9655D966; Thu, 10 Aug 2017 17:50:17 +0000 (UTC) From: Stefan Hajnoczi To: Date: Thu, 10 Aug 2017 18:48:22 +0100 Message-Id: <20170810174824.9580-2-stefanha@redhat.com> In-Reply-To: <20170810174824.9580-1-stefanha@redhat.com> References: <20170810174824.9580-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 10 Aug 2017 17:50:19 +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] [PULL for-2.10 1/3] 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: Peter Maydell , Stefan Hajnoczi Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 Message-id: 20170809160212.29976-2-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi --- 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 |= BUSY_STAT; ide_set_retry(s); block_acct_start(blk_get_stats(s->blk), &s->acct, 0, BLOCK_ACCT_FLUSH); - s->pio_aiocb = blk_aio_flush(s->blk, ide_flush_cb, s); + + if (blk_bs(s->blk)) { + s->pio_aiocb = blk_aio_flush(s->blk, ide_flush_cb, s); + } else { + /* XXX blk_aio_flush() crashes when blk_bs(blk) is NULL, remove this + * temporary workaround when blk_aio_*() functions handle NULL blk_bs. + */ + ide_flush_cb(s, 0); + } } static void ide_cfata_metadata_inquiry(IDEState *s)