From patchwork Wed Jun 30 11:55:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 57397 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 69AB4B6F10 for ; Wed, 30 Jun 2010 22:04:47 +1000 (EST) Received: from localhost ([127.0.0.1]:50151 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OTw1z-0005qG-9a for incoming@patchwork.ozlabs.org; Wed, 30 Jun 2010 08:04:43 -0400 Received: from [140.186.70.92] (port=56947 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OTvtS-0000oX-7H for qemu-devel@nongnu.org; Wed, 30 Jun 2010 07:55:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OTvtL-0000ZJ-Gn for qemu-devel@nongnu.org; Wed, 30 Jun 2010 07:55:54 -0400 Received: from oxygen.pond.sub.org ([213.239.205.148]:57031) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OTvtL-0000Yc-9q for qemu-devel@nongnu.org; Wed, 30 Jun 2010 07:55:47 -0400 Received: from blackfin.pond.sub.org (pD951BCA6.dip.t-dialin.net [217.81.188.166]) by oxygen.pond.sub.org (Postfix) with ESMTPA id 12532276D8C; Wed, 30 Jun 2010 13:55:44 +0200 (CEST) Received: by blackfin.pond.sub.org (Postfix, from userid 500) id EF335420; Wed, 30 Jun 2010 13:55:42 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 30 Jun 2010 13:55:35 +0200 Message-Id: <1277898942-6501-5-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1277898942-6501-1-git-send-email-armbru@redhat.com> References: <1277898942-6501-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: kwolf@redhat.com, kraxel@redhat.com, hch@lst.de Subject: [Qemu-devel] [PATCH 04/11] scsi: Reject unimplemented error actions 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 drive_init() doesn't permit rerror for if=scsi, but that's worthless: we get it via if=none and -device. Moreover, scsi-generic doesn't support werror. Since drive_init() doesn't catch that, option werror was silently ignored even with if=scsi. Signed-off-by: Markus Armbruster --- hw/scsi-disk.c | 5 +++++ hw/scsi-generic.c | 9 +++++++++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 3e41011..c30709c 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -1059,6 +1059,11 @@ static int scsi_disk_initfn(SCSIDevice *dev) s->bs = s->qdev.conf.bs; is_cd = bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM; + if (bdrv_get_on_error(s->bs, 1) != BLOCK_ERR_REPORT) { + error_report("Device doesn't support drive option rerror"); + return -1; + } + if (!s->serial) { /* try to fall back to value set with legacy -drive serial=... */ dinfo = drive_get_by_blockdev(s->bs); diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c index 3915e78..a8b4176 100644 --- a/hw/scsi-generic.c +++ b/hw/scsi-generic.c @@ -474,6 +474,15 @@ static int scsi_generic_initfn(SCSIDevice *dev) return -1; } + if (bdrv_get_on_error(s->bs, 0) != BLOCK_ERR_STOP_ENOSPC) { + error_report("Device doesn't support drive option werror"); + return -1; + } + if (bdrv_get_on_error(s->bs, 1) != BLOCK_ERR_REPORT) { + error_report("Device doesn't support drive option rerror"); + return -1; + } + /* check we are using a driver managing SG_IO (version 3 and after */ if (bdrv_ioctl(s->bs, SG_GET_VERSION_NUM, &sg_version) < 0 || sg_version < 30000) {