qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL for-2.7 0/5] Block patches
@ 2016-08-05  9:24 Stefan Hajnoczi
  2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 1/5] block/parallels: check new image size Stefan Hajnoczi
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2016-08-05  9:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Stefan Hajnoczi

The following changes since commit 42e0d60f1615ef63d16e41bb1668805560c37870:

  Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20160804' into staging (2016-08-04 18:36:05 +0100)

are available in the git repository at:

  git://github.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to 27d1b87688dcea8702f06b5240abf6b8d8f53346:

  virtio-blk: Remove stale comment about draining (2016-08-05 09:59:06 +0100)

----------------------------------------------------------------

----------------------------------------------------------------

Alberto Garcia (2):
  throttle: Don't allow burst limits to be lower than the normal limits
  throttle: Test burst limits lower than the normal limits

Fam Zheng (2):
  virtio-blk: Release s->rq queue at system_reset
  virtio-blk: Remove stale comment about draining

Klim Kireev (1):
  block/parallels: check new image size

 block/parallels.c     |  5 +++++
 hw/block/virtio-blk.c | 13 +++++++++----
 tests/test-throttle.c |  8 ++++++++
 util/throttle.c       |  5 +++++
 4 files changed, 27 insertions(+), 4 deletions(-)

-- 
2.7.4

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

* [Qemu-devel] [PULL for-2.7 1/5] block/parallels: check new image size
  2016-08-05  9:24 [Qemu-devel] [PULL for-2.7 0/5] Block patches Stefan Hajnoczi
@ 2016-08-05  9:24 ` Stefan Hajnoczi
  2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 2/5] throttle: Don't allow burst limits to be lower than the normal limits Stefan Hajnoczi
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2016-08-05  9:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Klim Kireev, Denis V . Lunev, Stefan Hajnoczi

From: Klim Kireev <proffk@virtuozzo.mipt.ru>

Before this patch incorrect image could be created via qemu-img
(Example: qemu-img create -f parallels -o size=4096T hack.img),
incorrect images cannot be used due to overflow in main image structure.

This patch add check of size in image creation.

After reading size it compare it with UINT32_MAX * cluster_size.

Signed-off-by: Klim Kireev <proffk@virtuozzo.mipt.ru>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Message-id: 1469639300-12155-1-git-send-email-den@openvz.org
CC: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/parallels.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/block/parallels.c b/block/parallels.c
index 807a801..2ccefa7 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -43,6 +43,7 @@
 #define HEADER_MAGIC2 "WithouFreSpacExt"
 #define HEADER_VERSION 2
 #define HEADER_INUSE_MAGIC  (0x746F6E59)
+#define MAX_PARALLELS_IMAGE_FACTOR (1ull << 32)
 
 #define DEFAULT_CLUSTER_SIZE 1048576        /* 1 MiB */
 
@@ -475,6 +476,10 @@ static int parallels_create(const char *filename, QemuOpts *opts, Error **errp)
                           BDRV_SECTOR_SIZE);
     cl_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_CLUSTER_SIZE,
                           DEFAULT_CLUSTER_SIZE), BDRV_SECTOR_SIZE);
+    if (total_size >= MAX_PARALLELS_IMAGE_FACTOR * cl_size) {
+        error_propagate(errp, local_err);
+        return -E2BIG;
+    }
 
     ret = bdrv_create_file(filename, opts, &local_err);
     if (ret < 0) {
-- 
2.7.4

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

* [Qemu-devel] [PULL for-2.7 2/5] throttle: Don't allow burst limits to be lower than the normal limits
  2016-08-05  9:24 [Qemu-devel] [PULL for-2.7 0/5] Block patches Stefan Hajnoczi
  2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 1/5] block/parallels: check new image size Stefan Hajnoczi
@ 2016-08-05  9:24 ` Stefan Hajnoczi
  2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 3/5] throttle: Test burst limits " Stefan Hajnoczi
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2016-08-05  9:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Alberto Garcia, Stefan Hajnoczi

From: Alberto Garcia <berto@igalia.com>

Setting FOO_max to a value that is lower than FOO does not make
sense, and it produces odd results depending on the value of
FOO_max_length. Although the user should not set that configuration
in the first place it's better to reject it explicitly.

https://bugzilla.redhat.com/show_bug.cgi?id=1355665

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reported-by: Gu Nini <ngu@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 663d5aca406060e31f80d8113f77b6feee63b919.1469693110.git.berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 util/throttle.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/util/throttle.c b/util/throttle.c
index 654f95c..3817d9b 100644
--- a/util/throttle.c
+++ b/util/throttle.c
@@ -348,6 +348,11 @@ bool throttle_is_valid(ThrottleConfig *cfg, Error **errp)
                        " bps/iops values");
             return false;
         }
+
+        if (cfg->buckets[i].max && cfg->buckets[i].max < cfg->buckets[i].avg) {
+            error_setg(errp, "bps_max/iops_max cannot be lower than bps/iops");
+            return false;
+        }
     }
 
     return true;
-- 
2.7.4

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

* [Qemu-devel] [PULL for-2.7 3/5] throttle: Test burst limits lower than the normal limits
  2016-08-05  9:24 [Qemu-devel] [PULL for-2.7 0/5] Block patches Stefan Hajnoczi
  2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 1/5] block/parallels: check new image size Stefan Hajnoczi
  2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 2/5] throttle: Don't allow burst limits to be lower than the normal limits Stefan Hajnoczi
@ 2016-08-05  9:24 ` Stefan Hajnoczi
  2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 4/5] virtio-blk: Release s->rq queue at system_reset Stefan Hajnoczi
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2016-08-05  9:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Alberto Garcia, Stefan Hajnoczi

From: Alberto Garcia <berto@igalia.com>

This checks that making FOO_max lower than FOO is not allowed.

We could also forbid having FOO_max == FOO, but that doesn't have
any odd side effects and it would require us to update several other
tests, so let's keep it simple.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 2f90f9ee58aa14b7bd985f67c5996b06e0ab6c19.1469693110.git.berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 tests/test-throttle.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/test-throttle.c b/tests/test-throttle.c
index afe094b..363b59a 100644
--- a/tests/test-throttle.c
+++ b/tests/test-throttle.c
@@ -394,6 +394,14 @@ static void test_max_is_missing_limit(void)
         cfg.buckets[i].max = 0;
         cfg.buckets[i].avg = 100;
         g_assert(throttle_is_valid(&cfg, NULL));
+
+        cfg.buckets[i].max = 30;
+        cfg.buckets[i].avg = 100;
+        g_assert(!throttle_is_valid(&cfg, NULL));
+
+        cfg.buckets[i].max = 100;
+        cfg.buckets[i].avg = 100;
+        g_assert(throttle_is_valid(&cfg, NULL));
     }
 }
 
-- 
2.7.4

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

* [Qemu-devel] [PULL for-2.7 4/5] virtio-blk: Release s->rq queue at system_reset
  2016-08-05  9:24 [Qemu-devel] [PULL for-2.7 0/5] Block patches Stefan Hajnoczi
                   ` (2 preceding siblings ...)
  2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 3/5] throttle: Test burst limits " Stefan Hajnoczi
@ 2016-08-05  9:24 ` Stefan Hajnoczi
  2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 5/5] virtio-blk: Remove stale comment about draining Stefan Hajnoczi
  2016-08-05 12:05 ` [Qemu-devel] [PULL for-2.7 0/5] Block patches Peter Maydell
  5 siblings, 0 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2016-08-05  9:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Fam Zheng, Stefan Hajnoczi

From: Fam Zheng <famz@redhat.com>

At system_reset, there is no point in retrying the queued request,
because the driver that issued the request won't be around any more.

Analyzed-by: Laszlo Ersek <lersek@redhat.com>
Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1470278654-13525-2-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/block/virtio-blk.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 475a822..1e348b1 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -654,6 +654,7 @@ static void virtio_blk_reset(VirtIODevice *vdev)
 {
     VirtIOBlock *s = VIRTIO_BLK(vdev);
     AioContext *ctx;
+    VirtIOBlockReq *req;
 
     /*
      * This should cancel pending requests, but can't do nicely until there
@@ -663,6 +664,14 @@ static void virtio_blk_reset(VirtIODevice *vdev)
     aio_context_acquire(ctx);
     blk_drain(s->blk);
 
+    /* We drop queued requests after blk_drain() because blk_drain() itself can
+     * produce them. */
+    while (s->rq) {
+        req = s->rq;
+        s->rq = req->next;
+        virtio_blk_free_request(req);
+    }
+
     if (s->dataplane) {
         virtio_blk_data_plane_stop(s->dataplane);
     }
-- 
2.7.4

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

* [Qemu-devel] [PULL for-2.7 5/5] virtio-blk: Remove stale comment about draining
  2016-08-05  9:24 [Qemu-devel] [PULL for-2.7 0/5] Block patches Stefan Hajnoczi
                   ` (3 preceding siblings ...)
  2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 4/5] virtio-blk: Release s->rq queue at system_reset Stefan Hajnoczi
@ 2016-08-05  9:24 ` Stefan Hajnoczi
  2016-08-05 12:05 ` [Qemu-devel] [PULL for-2.7 0/5] Block patches Peter Maydell
  5 siblings, 0 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2016-08-05  9:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Fam Zheng, Stefan Hajnoczi

From: Fam Zheng <famz@redhat.com>

This is stale after commit 6e40b3bf (virtio-blk: Use blk_drain() to
drain IO requests), remove it.

Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1470278654-13525-3-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/block/virtio-blk.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 1e348b1..331d766 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -656,10 +656,6 @@ static void virtio_blk_reset(VirtIODevice *vdev)
     AioContext *ctx;
     VirtIOBlockReq *req;
 
-    /*
-     * This should cancel pending requests, but can't do nicely until there
-     * are per-device request lists.
-     */
     ctx = blk_get_aio_context(s->blk);
     aio_context_acquire(ctx);
     blk_drain(s->blk);
-- 
2.7.4

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

* Re: [Qemu-devel] [PULL for-2.7 0/5] Block patches
  2016-08-05  9:24 [Qemu-devel] [PULL for-2.7 0/5] Block patches Stefan Hajnoczi
                   ` (4 preceding siblings ...)
  2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 5/5] virtio-blk: Remove stale comment about draining Stefan Hajnoczi
@ 2016-08-05 12:05 ` Peter Maydell
  5 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2016-08-05 12:05 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: QEMU Developers

On 5 August 2016 at 10:24, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> The following changes since commit 42e0d60f1615ef63d16e41bb1668805560c37870:
>
>   Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20160804' into staging (2016-08-04 18:36:05 +0100)
>
> are available in the git repository at:
>
>   git://github.com/stefanha/qemu.git tags/block-pull-request
>
> for you to fetch changes up to 27d1b87688dcea8702f06b5240abf6b8d8f53346:
>
>   virtio-blk: Remove stale comment about draining (2016-08-05 09:59:06 +0100)
>
> ----------------------------------------------------------------

Applied, thanks.

-- PMM

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

end of thread, other threads:[~2016-08-05 12:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-05  9:24 [Qemu-devel] [PULL for-2.7 0/5] Block patches Stefan Hajnoczi
2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 1/5] block/parallels: check new image size Stefan Hajnoczi
2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 2/5] throttle: Don't allow burst limits to be lower than the normal limits Stefan Hajnoczi
2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 3/5] throttle: Test burst limits " Stefan Hajnoczi
2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 4/5] virtio-blk: Release s->rq queue at system_reset Stefan Hajnoczi
2016-08-05  9:24 ` [Qemu-devel] [PULL for-2.7 5/5] virtio-blk: Remove stale comment about draining Stefan Hajnoczi
2016-08-05 12:05 ` [Qemu-devel] [PULL for-2.7 0/5] Block patches Peter Maydell

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