From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=39392 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWA9a-0006Mw-VZ for qemu-devel@nongnu.org; Tue, 06 Jul 2010 11:33:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OWA9Z-000095-L5 for qemu-devel@nongnu.org; Tue, 06 Jul 2010 11:33:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55237) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWA9Z-00008v-Cx for qemu-devel@nongnu.org; Tue, 06 Jul 2010 11:33:45 -0400 From: Kevin Wolf Date: Tue, 6 Jul 2010 17:33:18 +0200 Message-Id: <1278430406-18667-10-git-send-email-kwolf@redhat.com> In-Reply-To: <1278430406-18667-1-git-send-email-kwolf@redhat.com> References: <1278430406-18667-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 09/17] scsi: Reject unimplemented error actions List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Markus Armbruster 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. Wart: unlike drive_init(), we don't reject the default action when it's explicitly specified. That's because we can't distinguish "no rerror option" from "rerror=report", or "no werror" from "rerror=enospc". Left for another day. Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- 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) { -- 1.6.6.1