block/file-posix: implement bdrv_co_invalidate_cache() on Linux
commitdd577a26ff03b6829721b1ffbbf9e7c411b72378
authorStefan Hajnoczi <stefanha@redhat.com>
Fri, 27 Apr 2018 16:23:11 +0000 (27 17:23 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 11 May 2018 15:43:05 +0000 (11 16:43 +0100)
treeec343b39a86e09fb46717795974baa87e1416213
parent1a6fad0c3bdeb320ef78dd8ce966e637ff6d356b
block/file-posix: implement bdrv_co_invalidate_cache() on Linux

On Linux posix_fadvise(POSIX_FADV_DONTNEED) invalidates pages*.  Use
this to drop page cache on the destination host during shared storage
migration.  This way the destination host will read the latest copy of
the data and will not use stale data from the page cache.

The flow is as follows:

1. Source host writes out all dirty pages and inactivates drives.
2. QEMU_VM_EOF is sent on migration stream.
3. Destination host invalidates caches before accessing drives.

This patch enables live migration even with -drive cache.direct=off.

* Terms and conditions may apply, please see patch for details.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 20180427162312.18583-2-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/file-posix.c