qemu-patch-raspberry4/block
Stefan Hajnoczi 14fe292d86 qed: do not evict in-use L2 table cache entries
The L2 table cache reduces QED metadata reads that would be required
when translating LBAs to offsets into the image file.  Since requests
execute in parallel it is possible to share an L2 table between multiple
requests.

There is a potential data corruption issue when an in-use L2 table is
evicted from the cache because the following situation occurs:

  1. An allocating write performs an update to L2 table "A".

  2. Another request needs L2 table "B" and causes table "A" to be
     evicted.

  3. A new read request needs L2 table "A" but it is not cached.

As a result the L2 update from #1 can overlap with the L2 fetch from #3.
We must avoid doing overlapping I/O requests here since the worst case
outcome is that the L2 fetch completes before the L2 update and yields
stale data.  In that case we would effectively discard the L2 update and
lose data clusters!

Thanks to Benoît Canet <benoit.canet@gmail.com> for extensive testing
and debugging which lead to discovery of this bug.

Reported-by: Benoît Canet <benoit.canet@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Tested-by: Benoît Canet <benoit.canet@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:06 +01:00
..
blkdebug.c block: replace unchecked strdup/malloc/calloc with glib 2012-01-26 11:39:03 +01:00
blkverify.c block: replace unchecked strdup/malloc/calloc with glib 2012-01-26 11:39:03 +01:00
bochs.c block: take lock around bdrv_read implementations 2011-10-21 17:34:14 +02:00
cloop.c block/cloop: Use g_free instead of free 2011-11-04 14:24:12 +01:00
cow.c block/cow: Return real error code 2011-12-15 12:40:33 +01:00
curl.c block: qemu_aio_get does not return NULL 2011-12-15 12:40:08 +01:00
dmg.c block: take lock around bdrv_read implementations 2011-10-21 17:34:14 +02:00
iscsi.c iSCSI: add configuration variables for iSCSI 2012-02-09 16:17:50 +01:00
nbd.c nbd: add support for NBD_CMD_TRIM 2011-12-22 11:53:57 +01:00
parallels.c block: take lock around bdrv_read implementations 2011-10-21 17:34:14 +02:00
qcow.c qcow: Use bdrv functions to replace file operation 2012-01-26 14:49:18 +01:00
qcow2-cache.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qcow2-cluster.c qcow2: avoid reentrant bdrv_read() in copy_sectors() 2011-12-05 14:49:47 +01:00
qcow2-refcount.c qcow2: Fix order of refcount updates in qcow2_snapshot_goto 2011-12-05 14:51:36 +01:00
qcow2-snapshot.c qcow2: Allow >4 GB VM state 2011-12-15 12:40:33 +01:00
qcow2.c qcow2: Reject too large header extensions 2012-02-29 12:48:47 +01:00
qcow2.h qcow2: Keep unknown header extension when rewriting header 2012-02-09 16:17:51 +01:00
qed-check.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qed-cluster.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qed-gencb.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qed-l2-cache.c qed: do not evict in-use L2 table cache entries 2012-03-12 15:14:06 +01:00
qed-table.c block: bdrv_aio_* do not return NULL 2011-12-15 12:40:07 +01:00
qed.c qed: add .bdrv_co_write_zeroes() support 2012-02-09 16:17:50 +01:00
qed.h qed: add .bdrv_co_write_zeroes() support 2012-02-09 16:17:50 +01:00
raw-posix-aio.h prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
raw-posix.c block: bdrv_eject(): Make eject_flag a real bool 2012-02-22 17:23:05 -02:00
raw-win32.c block: Rename bdrv_co_flush to bdrv_co_flush_to_disk 2011-11-11 14:02:59 +01:00
raw.c block: bdrv_eject(): Make eject_flag a real bool 2012-02-22 17:23:05 -02:00
rbd.c rbd: wire up snapshot removal and rollback functionality 2012-01-26 11:39:03 +01:00
sheepdog.c sheepdog: fix co_recv coroutine context 2012-02-09 16:17:51 +01:00
stream.c block: add support for partial streaming 2012-01-26 14:49:18 +01:00
vdi.c block/vdi: Zero unused parts when allocating a new block (fix #919242) 2012-01-26 14:49:18 +01:00
vmdk.c block/vmdk: Fix warning from splint (comparision of unsigned value) 2012-03-07 13:03:51 +00:00
vpc.c vpc: Round up image size during fixed image creation 2012-02-09 16:17:51 +01:00
vvfat.c vvfat: avoid leaking file descriptor in commit_one_file() 2012-01-13 10:36:59 +00:00