Instead of using an assertion, it is better to emit a corruption event here. Checking all offsets for correct alignment can be tedious and it is easily possible to forget to do so. qcow2_cache_do_get() is a function every L2 and refblock access has to go through, so this is a good central point to add such a check. And for good measure, let us also add an assertion that the offset is non-zero. Making this a corruption event is not feasible, because a zero offset usually means something special (such as the cluster is unused), so all callers should be checking this anyway. If they do not, it is their fault, hence the assertion here. Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 20171110203111.7666-6-mreitz@redhat.com Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
403 lines
16 KiB
Plaintext
403 lines
16 KiB
Plaintext
QA output created by 060
|
|
|
|
=== Testing L2 reference into L1 ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
ERROR cluster 3 refcount=1 reference=3
|
|
|
|
1 errors were found on the image.
|
|
Data may be corrupted, or further writes to the image may corrupt it.
|
|
incompatible_features 0x0
|
|
qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with active L1 table); further corruption events will be suppressed
|
|
write failed: Input/output error
|
|
incompatible_features 0x2
|
|
image: TEST_DIR/t.IMGFMT
|
|
file format: IMGFMT
|
|
virtual size: 64M (67108864 bytes)
|
|
cluster_size: 65536
|
|
Format specific information:
|
|
compat: 1.1
|
|
lazy refcounts: false
|
|
refcount bits: 16
|
|
corrupt: true
|
|
can't open device TEST_DIR/t.IMGFMT: IMGFMT: Image is corrupt; cannot be opened read/write
|
|
no file open, try 'help open'
|
|
read 512/512 bytes at offset 0
|
|
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
|
=== Testing cluster data reference into refcount block ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
ERROR refcount block 0 refcount=2
|
|
ERROR cluster 2 refcount=1 reference=2
|
|
|
|
2 errors were found on the image.
|
|
Data may be corrupted, or further writes to the image may corrupt it.
|
|
incompatible_features 0x0
|
|
qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with refcount block); further corruption events will be suppressed
|
|
write failed: Input/output error
|
|
incompatible_features 0x2
|
|
ERROR refcount block 0 refcount=2
|
|
ERROR cluster 2 refcount=1 reference=2
|
|
Rebuilding refcount structure
|
|
Repairing cluster 1 refcount=1 reference=0
|
|
Repairing cluster 2 refcount=2 reference=1
|
|
The following inconsistencies were found and repaired:
|
|
|
|
0 leaked clusters
|
|
2 corruptions
|
|
|
|
Double checking the fixed image now...
|
|
No errors were found on the image.
|
|
incompatible_features 0x0
|
|
wrote 512/512 bytes at offset 0
|
|
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
incompatible_features 0x0
|
|
|
|
=== Testing cluster data reference into inactive L2 table ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
wrote 512/512 bytes at offset 0
|
|
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
wrote 512/512 bytes at offset 0
|
|
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
ERROR cluster 4 refcount=1 reference=2
|
|
Leaked cluster 9 refcount=1 reference=0
|
|
|
|
1 errors were found on the image.
|
|
Data may be corrupted, or further writes to the image may corrupt it.
|
|
|
|
1 leaked clusters were found on the image.
|
|
This means waste of disk space, but no harm to data.
|
|
incompatible_features 0x0
|
|
qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with inactive L2 table); further corruption events will be suppressed
|
|
write failed: Input/output error
|
|
incompatible_features 0x2
|
|
ERROR cluster 4 refcount=1 reference=2
|
|
Leaked cluster 9 refcount=1 reference=0
|
|
Repairing cluster 4 refcount=1 reference=2
|
|
Repairing cluster 9 refcount=1 reference=0
|
|
Repairing OFLAG_COPIED data cluster: l2_entry=8000000000040000 refcount=2
|
|
The following inconsistencies were found and repaired:
|
|
|
|
1 leaked clusters
|
|
2 corruptions
|
|
|
|
Double checking the fixed image now...
|
|
No errors were found on the image.
|
|
incompatible_features 0x0
|
|
wrote 512/512 bytes at offset 0
|
|
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
incompatible_features 0x0
|
|
read 512/512 bytes at offset 0
|
|
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
No errors were found on the image.
|
|
read 512/512 bytes at offset 0
|
|
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
|
=== Testing overlap while COW is in flight ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
|
wrote 65536/65536 bytes at offset 0
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
wrote 65536/65536 bytes at offset 536870912
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
discard 65536/65536 bytes at offset 0
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with active L2 table); further corruption events will be suppressed
|
|
blkdebug: Suspended request '0'
|
|
write failed: Input/output error
|
|
blkdebug: Resuming request '0'
|
|
aio_write failed: No medium found
|
|
|
|
=== Testing unallocated image header ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
wrote 65536/65536 bytes at offset 0
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with qcow2_header); further corruption events will be suppressed
|
|
write failed: Input/output error
|
|
|
|
=== Testing unaligned L1 entry ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
wrote 65536/65536 bytes at offset 0
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
qcow2: Marking image as corrupt: L2 table offset 0x42a00 unaligned (L1 index: 0); further corruption events will be suppressed
|
|
read failed: Input/output error
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
wrote 65536/65536 bytes at offset 0
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
qcow2: Marking image as corrupt: L2 table offset 0x42a00 unaligned (L1 index: 0); further corruption events will be suppressed
|
|
qemu-img: Error while amending options: Input/output error
|
|
|
|
=== Testing unaligned L2 entry ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
wrote 65536/65536 bytes at offset 0
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
qcow2: Marking image as corrupt: Cluster allocation offset 0x52a00 unaligned (L2 offset: 0x40000, L2 index: 0); further corruption events will be suppressed
|
|
read failed: Input/output error
|
|
|
|
=== Testing unaligned pre-allocated zero cluster ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
wrote 65536/65536 bytes at offset 0
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
qcow2: Marking image as corrupt: Cluster allocation offset 0x52a00 unaligned (L2 offset: 0x40000, L2 index: 0); further corruption events will be suppressed
|
|
qemu-img: Error while amending options: Input/output error
|
|
|
|
=== Testing unaligned reftable entry ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
qcow2: Marking image as corrupt: Refblock offset 0x22a00 unaligned (reftable index: 0); further corruption events will be suppressed
|
|
write failed: Input/output error
|
|
|
|
=== Testing non-fatal corruption on freeing ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
wrote 65536/65536 bytes at offset 0
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
qcow2: Image is corrupt: Cannot free unaligned cluster 0x52a00; further non-fatal corruption events will be suppressed
|
|
discard 65536/65536 bytes at offset 0
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
|
=== Testing read-only corruption report ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
wrote 65536/65536 bytes at offset 0
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
qcow2: Image is corrupt: Cluster allocation offset 0x52a00 unaligned (L2 offset: 0x40000, L2 index: 0); further non-fatal corruption events will be suppressed
|
|
read failed: Input/output error
|
|
read failed: Input/output error
|
|
|
|
=== Testing non-fatal and then fatal corruption report ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
wrote 131072/131072 bytes at offset 0
|
|
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
qcow2: Image is corrupt: Cannot free unaligned cluster 0x52a00; further non-fatal corruption events will be suppressed
|
|
qcow2: Marking image as corrupt: Cluster allocation offset 0x62a00 unaligned (L2 offset: 0x40000, L2 index: 0x1); further corruption events will be suppressed
|
|
discard 65536/65536 bytes at offset 0
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
read failed: Input/output error
|
|
|
|
=== Testing empty refcount table ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with refcount table); further corruption events will be suppressed
|
|
write failed: Input/output error
|
|
ERROR cluster 0 refcount=0 reference=1
|
|
ERROR cluster 1 refcount=0 reference=1
|
|
ERROR cluster 3 refcount=0 reference=1
|
|
Rebuilding refcount structure
|
|
Repairing cluster 1 refcount=1 reference=0
|
|
The following inconsistencies were found and repaired:
|
|
|
|
0 leaked clusters
|
|
3 corruptions
|
|
|
|
Double checking the fixed image now...
|
|
No errors were found on the image.
|
|
|
|
=== Testing empty refcount table with valid L1 and L2 tables ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
wrote 65536/65536 bytes at offset 0
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
qcow2: Marking image as corrupt: Preventing invalid allocation of refcount block at offset 0; further corruption events will be suppressed
|
|
write failed: Input/output error
|
|
ERROR cluster 0 refcount=0 reference=1
|
|
ERROR cluster 1 refcount=0 reference=1
|
|
ERROR cluster 3 refcount=0 reference=1
|
|
ERROR cluster 4 refcount=0 reference=1
|
|
ERROR cluster 5 refcount=0 reference=1
|
|
Rebuilding refcount structure
|
|
Repairing cluster 1 refcount=1 reference=0
|
|
The following inconsistencies were found and repaired:
|
|
|
|
0 leaked clusters
|
|
5 corruptions
|
|
|
|
Double checking the fixed image now...
|
|
No errors were found on the image.
|
|
|
|
=== Testing empty refcount block ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
qcow2: Marking image as corrupt: Preventing invalid allocation of L2 table at offset 0; further corruption events will be suppressed
|
|
write failed: Input/output error
|
|
ERROR cluster 0 refcount=0 reference=1
|
|
ERROR cluster 1 refcount=0 reference=1
|
|
ERROR cluster 2 refcount=0 reference=1
|
|
ERROR cluster 3 refcount=0 reference=1
|
|
Rebuilding refcount structure
|
|
Repairing cluster 1 refcount=1 reference=0
|
|
Repairing cluster 2 refcount=1 reference=0
|
|
The following inconsistencies were found and repaired:
|
|
|
|
0 leaked clusters
|
|
4 corruptions
|
|
|
|
Double checking the fixed image now...
|
|
No errors were found on the image.
|
|
|
|
=== Testing empty refcount block with compressed write ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
wrote 65536/65536 bytes at offset 65536
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
qcow2: Marking image as corrupt: Preventing invalid allocation of compressed cluster at offset 0; further corruption events will be suppressed
|
|
write failed: Input/output error
|
|
ERROR cluster 0 refcount=0 reference=1
|
|
ERROR cluster 1 refcount=0 reference=1
|
|
ERROR cluster 2 refcount=0 reference=1
|
|
ERROR cluster 3 refcount=0 reference=1
|
|
Rebuilding refcount structure
|
|
Repairing cluster 1 refcount=1 reference=0
|
|
Repairing cluster 2 refcount=1 reference=0
|
|
The following inconsistencies were found and repaired:
|
|
|
|
0 leaked clusters
|
|
4 corruptions
|
|
|
|
Double checking the fixed image now...
|
|
No errors were found on the image.
|
|
|
|
=== Testing zero refcount table size ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
can't open device TEST_DIR/t.IMGFMT: Image does not contain a reference count table
|
|
ERROR cluster 0 refcount=0 reference=1
|
|
ERROR cluster 3 refcount=0 reference=1
|
|
Rebuilding refcount structure
|
|
The following inconsistencies were found and repaired:
|
|
|
|
0 leaked clusters
|
|
2 corruptions
|
|
|
|
Double checking the fixed image now...
|
|
No errors were found on the image.
|
|
|
|
=== Testing incorrect refcount table offset ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
qcow2: Marking image as corrupt: Preventing invalid allocation of L2 table at offset 0; further corruption events will be suppressed
|
|
write failed: Input/output error
|
|
|
|
=== Testing dirty corrupt image ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
ERROR refcount block 0 is not cluster aligned; refcount table entry corrupted
|
|
IMGFMT: Marking image as corrupt: Refblock offset 0xffff2a00 unaligned (reftable index: 0); further corruption events will be suppressed
|
|
Can't get refcount for cluster 0: Input/output error
|
|
Can't get refcount for cluster 1: Input/output error
|
|
Can't get refcount for cluster 2: Input/output error
|
|
Can't get refcount for cluster 3: Input/output error
|
|
Rebuilding refcount structure
|
|
Repairing cluster 1 refcount=1 reference=0
|
|
can't open device TEST_DIR/t.IMGFMT: Could not repair dirty image: Input/output error
|
|
--- Repairing ---
|
|
Leaked cluster 1 refcount=1 reference=0
|
|
Repairing cluster 1 refcount=1 reference=0
|
|
The following inconsistencies were found and repaired:
|
|
|
|
1 leaked clusters
|
|
0 corruptions
|
|
|
|
Double checking the fixed image now...
|
|
No errors were found on the image.
|
|
|
|
=== Writing to an unaligned preallocated zero cluster ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
wrote 65536/65536 bytes at offset 0
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
discard 65536/65536 bytes at offset 0
|
|
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
qcow2: Marking image as corrupt: Preallocated zero cluster offset 0x2a00 unaligned (guest offset: 0); further corruption events will be suppressed
|
|
write failed: Input/output error
|
|
|
|
=== Discarding with an unaligned refblock ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
wrote 131072/131072 bytes at offset 0
|
|
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
qcow2: Marking image as corrupt: Refblock offset 0x2a00 unaligned (reftable index: 0); further corruption events will be suppressed
|
|
qcow2_free_clusters failed: Input/output error
|
|
discard failed: No medium found
|
|
--- Repairing ---
|
|
ERROR refcount block 0 is not cluster aligned; refcount table entry corrupted
|
|
qcow2: Marking image as corrupt: Refblock offset 0x2a00 unaligned (reftable index: 0); further corruption events will be suppressed
|
|
Can't get refcount for cluster 0: Input/output error
|
|
Can't get refcount for cluster 1: Input/output error
|
|
Can't get refcount for cluster 2: Input/output error
|
|
Can't get refcount for cluster 3: Input/output error
|
|
Can't get refcount for cluster 4: Input/output error
|
|
Can't get refcount for cluster 5: Input/output error
|
|
Can't get refcount for cluster 6: Input/output error
|
|
Rebuilding refcount structure
|
|
Repairing cluster 1 refcount=1 reference=0
|
|
qemu-img: Check failed: No medium found
|
|
Leaked cluster 1 refcount=1 reference=0
|
|
Repairing cluster 1 refcount=1 reference=0
|
|
The following inconsistencies were found and repaired:
|
|
|
|
1 leaked clusters
|
|
0 corruptions
|
|
|
|
Double checking the fixed image now...
|
|
No errors were found on the image.
|
|
|
|
=== Discarding an out-of-bounds refblock ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
qcow2: Marking image as corrupt: Refblock at 0xffffff00000000 is not covered by the refcount structures; further corruption events will be suppressed
|
|
qemu-img: Failed to discard unused refblocks: Input/output error
|
|
--- Checking and retrying ---
|
|
virtual size: 64M (67108864 bytes)
|
|
No errors were found on the image.
|
|
Image resized.
|
|
virtual size: 32M (33554432 bytes)
|
|
|
|
=== Discarding a non-covered in-bounds refblock ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
qcow2: Marking image as corrupt: Refblock at 0x1000000000 is not covered by the refcount structures; further corruption events will be suppressed
|
|
qemu-img: Failed to discard unused refblocks: Input/output error
|
|
--- Checking and retrying ---
|
|
virtual size: 64M (67108864 bytes)
|
|
No errors were found on the image.
|
|
Image resized.
|
|
virtual size: 32M (33554432 bytes)
|
|
|
|
=== Discarding a refblock covered by an unaligned refblock ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|
qcow2: Marking image as corrupt: Cannot get entry from refcount block cache: Offset 0x200 is unaligned; further corruption events will be suppressed
|
|
qemu-img: Failed to discard unused refblocks: Input/output error
|
|
--- Repairing ---
|
|
Repairing refcount block 1 is outside image
|
|
ERROR refcount block 2 is not cluster aligned; refcount table entry corrupted
|
|
qcow2: Marking image as corrupt: Refblock offset 0x200 unaligned (reftable index: 0x2); further corruption events will be suppressed
|
|
Can't get refcount for cluster 1048576: Input/output error
|
|
Rebuilding refcount structure
|
|
Repairing cluster 1 refcount=1 reference=0
|
|
Repairing cluster 2 refcount=1 reference=0
|
|
Repairing cluster 1048576 refcount=1 reference=0
|
|
qemu-img: Check failed: No medium found
|
|
Leaked cluster 1 refcount=1 reference=0
|
|
Leaked cluster 2 refcount=1 reference=0
|
|
Leaked cluster 1048576 refcount=1 reference=0
|
|
Repairing cluster 1 refcount=1 reference=0
|
|
Repairing cluster 2 refcount=1 reference=0
|
|
Repairing cluster 1048576 refcount=1 reference=0
|
|
The following inconsistencies were found and repaired:
|
|
|
|
3 leaked clusters
|
|
0 corruptions
|
|
|
|
Double checking the fixed image now...
|
|
No errors were found on the image.
|
|
*** done
|