qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Check and repair duplicated clusters in parallels images
@ 2022-08-05 15:47 alexander.ivanov
  2022-08-05 15:47 ` [PATCH v2 1/3] parallels: Put the image checks in separate functions alexander.ivanov
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: alexander.ivanov @ 2022-08-05 15:47 UTC (permalink / raw)
  To: qemu-devel
  Cc: den, natalia.kuzmina, stefanha, vsementsov, kwolf, hreitz,
	qemu-block

From: Alexander Ivanov <alexander.ivanov@virtuozzo.com>

We will add more and more checks of images so we need to reorganize the code.
Put each check to a separate helper function with a separate loop.
Add two helpers: truncate_file() and sync_header(). They will be used
in multiple functions.

Parallels image file can be corrupted this way: two guest memory areas
refer to the same host memory area (duplicated offsets in BAT).
qemu-img check copies data from duplicated cluster to the new cluster and
writes new corresponding offset to BAT instead of duplicated one.

Test 314 uses sample corrupted image parallels-2-duplicated-cluster.bz2.
Reading from duplicated offset and from original offset returns the same
data. After repairing changing either of these blocks of data
does not affect another one.

v2 changes:
 * Split parallels_co_check() to separate functions.
 * Move buffer allocation outside the loop.
 * Replace work with internals by zeroing BAT entries and
   allocate_clusters() calling.
 * Make reverse table unsigned and replace -1 by 0xFFFFFFFF.
 * Some minor fixes.
 * Add more detailed comments.

Alexander Ivanov (3):
  parallels: Put the image checks in separate functions
  parallels: Add checking and repairing duplicate offsets in BAT
  iotests, parallels: Add a test for duplicated clusters

 block/parallels.c                             | 315 +++++++++++++++---
 tests/qemu-iotests/314                        |  89 +++++
 tests/qemu-iotests/314.out                    |  36 ++
 .../parallels-2-duplicated-cluster.bz2        | Bin 0 -> 148 bytes
 4 files changed, 393 insertions(+), 47 deletions(-)
 create mode 100755 tests/qemu-iotests/314
 create mode 100644 tests/qemu-iotests/314.out
 create mode 100644 tests/qemu-iotests/sample_images/parallels-2-duplicated-cluster.bz2

-- 
2.34.1



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

end of thread, other threads:[~2022-08-06 21:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-05 15:47 [PATCH v2 0/3] Check and repair duplicated clusters in parallels images alexander.ivanov
2022-08-05 15:47 ` [PATCH v2 1/3] parallels: Put the image checks in separate functions alexander.ivanov
2022-08-06 19:00   ` Vladimir Sementsov-Ogievskiy
2022-08-05 15:47 ` [PATCH v2 2/3] parallels: Add checking and repairing duplicate offsets in BAT alexander.ivanov
2022-08-06 20:45   ` Vladimir Sementsov-Ogievskiy
2022-08-06 21:07     ` Denis V. Lunev
2022-08-05 15:47 ` [PATCH v2 3/3] iotests, parallels: Add a test for duplicated clusters alexander.ivanov
2022-08-06 20:56   ` Vladimir Sementsov-Ogievskiy

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