qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] block: init bs->io_base correctly to avoid locking


From: Peter Lieven
Subject: [Qemu-devel] [PATCH] block: init bs->io_base correctly to avoid locking
Date: Thu, 10 Jan 2013 10:21:20 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2

If io_limits are specified during runtime that exceed the number of operations 
in flight
bs->io_base is not initialized in the else statement in bdrv_exceed_io_limits().
The wait time calculated in bdrv_exceed_{bps,iops}_limits is thus totally wrong
and the machine locks.

Signed-off-by: Peter Lieven <address@hidden>
---
 block.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/block.c b/block.c
index 4e28c55..309aa85 100644
--- a/block.c
+++ b/block.c
@@ -159,6 +159,10 @@ void bdrv_io_limits_enable(BlockDriverState *bs)
     bs->slice_start = qemu_get_clock_ns(vm_clock);
     bs->slice_end   = bs->slice_start + bs->slice_time;
     memset(&bs->io_base, 0, sizeof(bs->io_base));
+    bs->io_base.bytes[0] = bs->nr_bytes[0];
+    bs->io_base.bytes[1] = bs->nr_bytes[1];
+    bs->io_base.ios[0] = bs->nr_ops[0];
+    bs->io_base.ios[1] = bs->nr_ops[1];
     bs->io_limits_enabled = true;
 }

--
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]