On 02/06/2015 08:27 AM, Eric Blake wrote:

>>  
>> -    /* The cluster refcount was incremented, either by 
>> qcow2_alloc_clusters()
>> -     * or explicitly by qcow2_update_cluster_refcount().  Refcount blocks 
>> must
>> -     * be flushed before the caller's L2 table updates.
>> -     */
>> +    assert(offset);
>> +    ret = update_refcount(bs, offset, size, 1, QCOW2_DISCARD_NEVER);
> 
> Case 1: This incremented the new cluster. Good
> Case 2: This incremented the old cluster. Good
> Case 3: This incremented the new cluster. Good
> Case 4: This incremented the old cluster. But the new cluster remains at
> refcount 0.  BAD.

Wait. Maybe I'm confused.  You are requesting an update_refcount()
across size bytes, and given the offset, that means that the code will
round up to cover BOTH clusters in one call.  Does update_refcount()
properly increment from  [ 1, 0 ] to [ 2, 1 ] when given a 2-cluster
size (when offset, size is rounded up to cluster boundaries)?  If so,
then there is no bug after all.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to