From patchwork Thu Feb 25 15:06:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 46242 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 18145B7C33 for ; Fri, 26 Feb 2010 02:11:35 +1100 (EST) Received: from localhost ([127.0.0.1]:48471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkfNE-0004mG-5G for incoming@patchwork.ozlabs.org; Thu, 25 Feb 2010 10:11:32 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NkfJE-0003Vu-0Z for qemu-devel@nongnu.org; Thu, 25 Feb 2010 10:07:24 -0500 Received: from [199.232.76.173] (port=38075 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkfJD-0003UZ-3a for qemu-devel@nongnu.org; Thu, 25 Feb 2010 10:07:23 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NkfJB-0008Qb-TR for qemu-devel@nongnu.org; Thu, 25 Feb 2010 10:07:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1025) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NkfJB-0008QO-Hw for qemu-devel@nongnu.org; Thu, 25 Feb 2010 10:07:21 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1PF7Jw8012385 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 25 Feb 2010 10:07:20 -0500 Received: from localhost (vpn-9-86.rdu.redhat.com [10.11.9.86]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1PF7Iwp004820 for ; Thu, 25 Feb 2010 10:07:19 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Thu, 25 Feb 2010 12:06:58 -0300 Message-Id: <1267110422-25873-2-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1267110422-25873-1-git-send-email-lcapitulino@redhat.com> References: <1267110422-25873-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 1/5] block: Emit BLOCK_IO_ERROR before vm_stop() call X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The next commit will move the STOP event into do_vm_stop(), to have the expected event sequence we need to emit the I/O error event before calling vm_stop(). The expected sequence is: { "event": "BLOCK_IO_ERROR" [...] } { "event": "STOP" } Signed-off-by: Luiz Capitulino --- hw/ide/core.c | 2 +- hw/scsi-disk.c | 2 +- hw/virtio-blk.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index 2e0971d..67480bb 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -491,8 +491,8 @@ static int ide_handle_rw_error(IDEState *s, int error, int op) || action == BLOCK_ERR_STOP_ANY) { s->bus->bmdma->unit = s->unit; s->bus->bmdma->status |= op; - vm_stop(0); bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read); + vm_stop(0); } else { if (op & BM_STATUS_DMA_RETRY) { dma_buf_commit(s, 0); diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index b2f61fe..7bb9c6c 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -190,8 +190,8 @@ static int scsi_handle_write_error(SCSIDiskReq *r, int error) if ((error == ENOSPC && action == BLOCK_ERR_STOP_ENOSPC) || action == BLOCK_ERR_STOP_ANY) { r->status |= SCSI_REQ_STATUS_RETRY; - vm_stop(0); bdrv_mon_event(s->bs, BDRV_ACTION_STOP, 0); + vm_stop(0); } else { scsi_command_complete(r, CHECK_CONDITION, HARDWARE_ERROR); diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index b80402d..8939bb2 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -72,8 +72,8 @@ static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error, || action == BLOCK_ERR_STOP_ANY) { req->next = s->rq; s->rq = req; - vm_stop(0); bdrv_mon_event(req->dev->bs, BDRV_ACTION_STOP, is_read); + vm_stop(0); } else { virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); bdrv_mon_event(req->dev->bs, BDRV_ACTION_REPORT, is_read);