qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/5] Block patches
@ 2010-07-13 15:54 Kevin Wolf
  2010-07-13 15:54 ` [Qemu-devel] [PATCH 1/5] qemu-img: Fix copy+paste bug in documentation Kevin Wolf
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Kevin Wolf @ 2010-07-13 15:54 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

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(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 1/5] qemu-img: Fix copy+paste bug in documentation
  2010-07-13 15:54 [Qemu-devel] [PULL 0/5] Block patches Kevin Wolf
@ 2010-07-13 15:54 ` Kevin Wolf
  2010-07-13 15:54 ` [Qemu-devel] [PATCH 2/5] Block migration fail, ignore error from bdrv_getlength Kevin Wolf
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Kevin Wolf @ 2010-07-13 15:54 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Stefan Weil <weil@mail.berlios.de>

Replace rebase by resize in documentation of resize command.

Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Kevin Wolf <kwolf@redhat.com>

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu-img-cmds.hx |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
index c4cf3e7..6d3e5f8 100644
--- a/qemu-img-cmds.hx
+++ b/qemu-img-cmds.hx
@@ -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
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 2/5] Block migration fail, ignore error from bdrv_getlength
  2010-07-13 15:54 [Qemu-devel] [PULL 0/5] Block patches Kevin Wolf
  2010-07-13 15:54 ` [Qemu-devel] [PATCH 1/5] qemu-img: Fix copy+paste bug in documentation Kevin Wolf
@ 2010-07-13 15:54 ` Kevin Wolf
  2010-07-13 15:54 ` [Qemu-devel] [PATCH 3/5] virtio-pci: Check for virtio_blk_init() failure Kevin Wolf
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Kevin Wolf @ 2010-07-13 15:54 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Shahar Havivi <shaharh@redhat.com>

When there is no block driver associate with BlockDriverState bdrv_getlength
returns -ENOMEDIUM that cause block migration to fail

Signed-off-by: Shahar Havivi <shaharh@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block-migration.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/block-migration.c b/block-migration.c
index 7db6f02..a77106e 100644
--- a/block-migration.c
+++ b/block-migration.c
@@ -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;
         }
 
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 3/5] virtio-pci: Check for virtio_blk_init() failure
  2010-07-13 15:54 [Qemu-devel] [PULL 0/5] Block patches Kevin Wolf
  2010-07-13 15:54 ` [Qemu-devel] [PATCH 1/5] qemu-img: Fix copy+paste bug in documentation Kevin Wolf
  2010-07-13 15:54 ` [Qemu-devel] [PATCH 2/5] Block migration fail, ignore error from bdrv_getlength Kevin Wolf
@ 2010-07-13 15:54 ` Kevin Wolf
  2010-07-13 15:54 ` [Qemu-devel] [PATCH 4/5] virtio-blk: Fix virtio-blk-s390 to require drive Kevin Wolf
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Kevin Wolf @ 2010-07-13 15:54 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Markus Armbruster <armbru@redhat.com>

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.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/virtio-pci.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index c728fff..5583166 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -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,
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 4/5] virtio-blk: Fix virtio-blk-s390 to require drive
  2010-07-13 15:54 [Qemu-devel] [PULL 0/5] Block patches Kevin Wolf
                   ` (2 preceding siblings ...)
  2010-07-13 15:54 ` [Qemu-devel] [PATCH 3/5] virtio-pci: Check for virtio_blk_init() failure Kevin Wolf
@ 2010-07-13 15:54 ` Kevin Wolf
  2010-07-13 15:54 ` [Qemu-devel] [PATCH 5/5] ide scsi virtio-blk: Reject empty drives unless media is removable Kevin Wolf
  2010-07-13 16:43 ` [Qemu-devel] [PULL 0/5] Block patches Brian Jackson
  5 siblings, 0 replies; 8+ messages in thread
From: Kevin Wolf @ 2010-07-13 15:54 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Markus Armbruster <armbru@redhat.com>

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.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/virtio-blk.c |    6 ++++++
 hw/virtio-pci.c |    4 ----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index 8747634..99e9dd2 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -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));
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 5583166..31a711e 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -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;
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 5/5] ide scsi virtio-blk: Reject empty drives unless media is removable
  2010-07-13 15:54 [Qemu-devel] [PULL 0/5] Block patches Kevin Wolf
                   ` (3 preceding siblings ...)
  2010-07-13 15:54 ` [Qemu-devel] [PATCH 4/5] virtio-blk: Fix virtio-blk-s390 to require drive Kevin Wolf
@ 2010-07-13 15:54 ` Kevin Wolf
  2010-07-13 16:43 ` [Qemu-devel] [PULL 0/5] Block patches Brian Jackson
  5 siblings, 0 replies; 8+ messages in thread
From: Kevin Wolf @ 2010-07-13 15:54 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Markus Armbruster <armbru@redhat.com>

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.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/ide/core.c   |    4 ++++
 hw/scsi-disk.c  |    5 +++++
 hw/virtio-blk.c |    4 ++++
 3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index af52c2c..e20f2e7 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -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;
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index c30709c..f43f2d0 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 (!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;
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index 99e9dd2..f50069d 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -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),
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PULL 0/5] Block patches
  2010-07-13 15:54 [Qemu-devel] [PULL 0/5] Block patches Kevin Wolf
                   ` (4 preceding siblings ...)
  2010-07-13 15:54 ` [Qemu-devel] [PATCH 5/5] ide scsi virtio-blk: Reject empty drives unless media is removable Kevin Wolf
@ 2010-07-13 16:43 ` Brian Jackson
  2010-07-13 16:47   ` Kevin Wolf
  5 siblings, 1 reply; 8+ messages in thread
From: Brian Jackson @ 2010-07-13 16:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf

On Tuesday, July 13, 2010 10:54:21 am Kevin Wolf wrote:
> These are some more fixes that should go into 0.13.


Any of these 0.12-stable material?


> 
> 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(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PULL 0/5] Block patches
  2010-07-13 16:43 ` [Qemu-devel] [PULL 0/5] Block patches Brian Jackson
@ 2010-07-13 16:47   ` Kevin Wolf
  0 siblings, 0 replies; 8+ messages in thread
From: Kevin Wolf @ 2010-07-13 16:47 UTC (permalink / raw)
  To: Brian Jackson; +Cc: qemu-devel

Am 13.07.2010 18:43, schrieb Brian Jackson:
> On Tuesday, July 13, 2010 10:54:21 am Kevin Wolf wrote:
>> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-07-13 16:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-13 15:54 [Qemu-devel] [PULL 0/5] Block patches Kevin Wolf
2010-07-13 15:54 ` [Qemu-devel] [PATCH 1/5] qemu-img: Fix copy+paste bug in documentation Kevin Wolf
2010-07-13 15:54 ` [Qemu-devel] [PATCH 2/5] Block migration fail, ignore error from bdrv_getlength Kevin Wolf
2010-07-13 15:54 ` [Qemu-devel] [PATCH 3/5] virtio-pci: Check for virtio_blk_init() failure Kevin Wolf
2010-07-13 15:54 ` [Qemu-devel] [PATCH 4/5] virtio-blk: Fix virtio-blk-s390 to require drive Kevin Wolf
2010-07-13 15:54 ` [Qemu-devel] [PATCH 5/5] ide scsi virtio-blk: Reject empty drives unless media is removable Kevin Wolf
2010-07-13 16:43 ` [Qemu-devel] [PULL 0/5] Block patches Brian Jackson
2010-07-13 16:47   ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).