Block patches
These are some more fixes that should go into 0.13.
The following changes since commit f077caa99c21847152e706e222277b378cb0ec2f:
Merge remote branch 'mst/for_anthony' into staging (2010-07-13 08:56:27 -0500)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git for-anthony
Markus Armbruster (3):
virtio-pci: Check for virtio_blk_init() failure
virtio-blk: Fix virtio-blk-s390 to require drive
ide scsi virtio-blk: Reject empty drives unless media is removable
Shahar Havivi (1):
Block migration fail, ignore error from bdrv_getlength
Stefan Weil (1):
qemu-img: Fix copy+paste bug in documentation
block-migration.c | 2 +- hw/ide/core.c | 4 ++++ hw/scsi-disk.c | 5 +++++ hw/virtio-blk.c | 10 ++++++++++ hw/virtio-pci.c | 5 ++--- qemu-img-cmds.hx | 2 +- 6 files changed, 23 insertions(+), 5 deletions(-)
PATCH 1/5 qemu-img: Fix copy+paste bug in documentation
From: Stefan Weil <[email protected]>
Replace rebase by resize in documentation of resize command.
--- qemu-img-cmds.hx | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
qemu-img-cmds.hx +1 -1
@@ -54,6 +54,6 @@ ETEXI DEF("resize", img_resize, "resize filename [+ | -]size") STEXI -@item rebase @var{filename} [+ | -]@var{size} +@item resize @var{filename} [+ | -]@var{size} @end table ETEXI
Signature · 1 line
1.7.1.1
PATCH 2/5 Block migration fail, ignore error from bdrv_getlength
In reply to Kevin WolfFrom: Shahar Havivi <[email protected]>
When there is no block driver associate with BlockDriverState bdrv_getlength returns -ENOMEDIUM that cause block migration to fail
--- block-migration.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
block-migration.c +1 -1
@@ -238,7 +238,7 @@ static void init_blk_migration_it(void *opaque, BlockDriverState *bs)if (!bdrv_is_read_only (bs)) { sectors =bdrv_getlength (bs) >>BDRV_SECTOR_BITS ; -if (sectors ==0 ) { +if (sectors <=0 ) {return ; }
Signature · 1 line
1.7.1.1
PATCH 3/5 virtio-pci: Check for virtio_blk_init() failure
In reply to Kevin WolfFrom: Markus Armbruster <[email protected]>
It can't actually fail now, but the next commit will change that.
s390_virtio_blk_init() already checks for failure, but virtio_blk_init_pci() doesn't. Fix that.
--- hw/virtio-pci.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
hw/virtio-pci.c +3 -0
@@ -551,6 +551,9 @@ static int virtio_blk_init_pci(PCIDevice *pci_dev)return -1 ; } vdev =virtio_blk_init (&pci_dev->qdev, &proxy->block); +if (!vdev) { +return -1 ; + } vdev->nvectors = proxy->nvectors; virtio_init_pci(proxy, vdev, PCI_VENDOR_ID_REDHAT_QUMRANET,
Signature · 1 line
1.7.1.1
PATCH 4/5 virtio-blk: Fix virtio-blk-s390 to require drive
In reply to Kevin WolfFrom: Markus Armbruster <[email protected]>
Move the check from virtio_blk_init_pci(), where it protects only virtio-blk-pci, to virtio_blk_init(). Without that, virtio-blk-s390 initializes without a drive. I figure that can lead to null pointer dereferences.
--- hw/virtio-blk.c | 6 ++++++ hw/virtio-pci.c | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-)
hw/virtio-blk.c +6 -0
@@ -12,6 +12,7 @@*/ #include <qemu-common.h> +#include "qemu-error.h" #include "virtio-blk.h" #ifdef __linux__# include <scsi/sg.h>
@@ -490,6 +491,11 @@ VirtIODevice *virtio_blk_init(DeviceState *dev, BlockConf *conf)static int virtio_blk_id;DriveInfo *dinfo; +if (!conf->bs) { +error_report ("virtio-blk-pci: drive property not set" ); +return NULL ; + } + s = (VirtIOBlock *)virtio_common_init ("virtio-blk" ,VIRTIO_ID_BLOCK ,sizeof (struct virtio_blk_config ),sizeof (VirtIOBlock));
hw/virtio-pci.c +0 -4
@@ -546,10 +546,6 @@ static int virtio_blk_init_pci(PCIDevice *pci_dev) proxy->class_code != PCI_CLASS_STORAGE_OTHER) proxy->class_code =PCI_CLASS_STORAGE_SCSI ; -if (!proxy->block.bs) { -error_report ("virtio-blk-pci: drive property not set" ); -return -1 ; - } vdev =virtio_blk_init (&pci_dev->qdev, &proxy->block);if (!vdev) {return -1 ;
Signature · 1 line
1.7.1.1
PATCH 5/5 ide scsi virtio-blk: Reject empty drives unless media is removable
In reply to Kevin WolfFrom: Markus Armbruster <[email protected]>
Disks without media make no sense. For SCSI, a Linux guest kernel complains during boot. I didn't try other combinations.
scsi-generic doesn't need the additional check, because it already requires bdrv_is_sg(), which fails without media.
--- hw/ide/core.c | 4 ++++ hw/scsi-disk.c | 5 +++++ hw/virtio-blk.c | 4 ++++ 3 files changed, 13 insertions(+), 0 deletions(-)
hw/ide/core.c +4 -0
@@ -2630,6 +2630,10 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs, s->drive_kind =IDE_CD ;bdrv_set_change_cb (bs, cdrom_change_cb, s); }else { +if (!bdrv_is_inserted (s->bs)) { +error_report ("Device needs media, but drive is empty" ); +return -1 ; + }if (bdrv_is_read_only (bs)) {error_report ("Can't use a read-only drive" );return -1 ;
hw/scsi-disk.c +5 -0
@@ -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 (!is_cd && !bdrv_is_inserted (s->bs)) { +error_report ("Device needs media, but drive is empty" ); +return -1 ; + } +if (bdrv_get_on_error (s->bs,1 ) !=BLOCK_ERR_REPORT ) {error_report ("Device doesn't support drive option rerror" );return -1 ;
hw/virtio-blk.c +4 -0
@@ -495,6 +495,10 @@ VirtIODevice *virtio_blk_init(DeviceState *dev, BlockConf *conf)error_report ("virtio-blk-pci: drive property not set" );return NULL ; } +if (!bdrv_is_inserted (conf->bs)) { +error_report ("Device needs media, but drive is empty" ); +return NULL ; + } s = (VirtIOBlock *)virtio_common_init("virtio-blk", VIRTIO_ID_BLOCK, sizeof(struct virtio_blk_config),
Signature · 1 line
1.7.1.1
Quoted 1 line · Kevin Wolf
These are some more fixes that should go into 0.13.
Any of these 0.12-stable material?
Quoted 29 lines
The following changes since commit
f077caa99c21847152e706e222277b378cb0ec2f:Merge remote branch 'mst/for_anthony' into staging (2010-07-13 08:56:27
-0500)are available in the git repository at:
git://repo.or.cz/qemu/kevin.gitfor-anthonyMarkus Armbruster (3):
virtio-pci: Check forvirtio_blk_init()failure
virtio-blk: Fix virtio-blk-s390 to require drive
ide scsi virtio-blk: Reject empty drives unless media is removableShahar Havivi (1):
Block migration fail, ignore error frombdrv_getlengthStefan Weil (1):
qemu-img: Fix copy+paste bug in documentationblock-migration.c | 2 +- hw/ide/core.c | 4 ++++ hw/scsi-disk.c | 5 +++++ hw/virtio-blk.c | 10 ++++++++++ hw/virtio-pci.c | 5 ++--- qemu-img-cmds.hx | 2 +- 6 files changed, 23 insertions(+), 5 deletions(-)
Am 13.07.2010 18:43, schrieb Brian Jackson:
Quoted 5 lines · Kevin Wolf
Quoted 1 line
These are some more fixes that should go into 0.13.
Any of these 0.12-stable material?
I'll try to have a closer look tomorrow. Probably not these, but I think there are some more patches in git master which could go into 0.12-stable.
Kevin