Re: [Qemu-devel] [PATCH 05/21] qcow2: Refcount overflow and qcow2_alloc_bytes()

2014-11-12 Thread Max Reitz
On 2014-11-11 at 20:49, Eric Blake wrote: On 11/11/2014 09:18 AM, Max Reitz wrote: No, I was envisioning that we have a brand new image with one cluster allocated (cluster 1 has refcount 1), then 5 times in a row we do 'savevm' to take an internal snapshot. If I understand your code correctly,

Re: [Qemu-devel] [PATCH 05/21] qcow2: Refcount overflow and qcow2_alloc_bytes()

2014-11-11 Thread Eric Blake
On 11/11/2014 09:18 AM, Max Reitz wrote: >> No, I was envisioning that we have a brand new image with one cluster >> allocated (cluster 1 has refcount 1), then 5 times in a row we do >> 'savevm' to take an internal snapshot. If I understand your code >> correctly, the first two snapshots increase

Re: [Qemu-devel] [PATCH 05/21] qcow2: Refcount overflow and qcow2_alloc_bytes()

2014-11-11 Thread Max Reitz
On 2014-11-11 at 17:13, Eric Blake wrote: On 11/11/2014 01:22 AM, Max Reitz wrote: On 2014-11-10 at 22:12, Eric Blake wrote: On 11/10/2014 06:45 AM, Max Reitz wrote: qcow2_alloc_bytes() may reuse a cluster multiple times, in which case the refcount is increased accordingly. However, if this wo

Re: [Qemu-devel] [PATCH 05/21] qcow2: Refcount overflow and qcow2_alloc_bytes()

2014-11-11 Thread Eric Blake
On 11/11/2014 01:22 AM, Max Reitz wrote: > On 2014-11-10 at 22:12, Eric Blake wrote: >> On 11/10/2014 06:45 AM, Max Reitz wrote: >>> qcow2_alloc_bytes() may reuse a cluster multiple times, in which case >>> the refcount is increased accordingly. However, if this would lead to an >>> overflow the fu

Re: [Qemu-devel] [PATCH 05/21] qcow2: Refcount overflow and qcow2_alloc_bytes()

2014-11-11 Thread Max Reitz
On 2014-11-10 at 22:12, Eric Blake wrote: On 11/10/2014 06:45 AM, Max Reitz wrote: qcow2_alloc_bytes() may reuse a cluster multiple times, in which case the refcount is increased accordingly. However, if this would lead to an overflow the function should instead just not reuse this cluster and a

Re: [Qemu-devel] [PATCH 05/21] qcow2: Refcount overflow and qcow2_alloc_bytes()

2014-11-10 Thread Eric Blake
On 11/10/2014 06:45 AM, Max Reitz wrote: > qcow2_alloc_bytes() may reuse a cluster multiple times, in which case > the refcount is increased accordingly. However, if this would lead to an > overflow the function should instead just not reuse this cluster and > allocate a new one. So if recount_ord

[Qemu-devel] [PATCH 05/21] qcow2: Refcount overflow and qcow2_alloc_bytes()

2014-11-10 Thread Max Reitz
qcow2_alloc_bytes() may reuse a cluster multiple times, in which case the refcount is increased accordingly. However, if this would lead to an overflow the function should instead just not reuse this cluster and allocate a new one. Signed-off-by: Max Reitz --- block/qcow2-refcount.c | 32 +++