1 | The following changes since commit d84f714eafedd8bb9d4aaec8b76417bef8e3535e: | 1 | The following changes since commit 61c265f0660ee476985808c8aa7915617c44fd53: |
---|---|---|---|
2 | 2 | ||
3 | Update version for v2.9.0-rc0 release (2017-03-14 19:18:23 +0000) | 3 | Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20200313a' into staging (2020-03-13 10:33:04 +0000) |
4 | 4 | ||
5 | are available in the git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | git://github.com/stefanha/qemu.git tags/block-pull-request | 7 | https://github.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to 9dc44aa5829eb3131a01378a738dee28a382bbc1: | 9 | for you to fetch changes up to 4ab78b19189a81038e744728ed949d09aa477550: |
10 | 10 | ||
11 | os: don't corrupt pre-existing memory-backend data with prealloc (2017-03-15 11:55:41 +0800) | 11 | block/io: fix bdrv_co_do_copy_on_readv (2020-03-16 11:46:11 +0000) |
12 | |||
13 | ---------------------------------------------------------------- | ||
14 | Pull request | ||
12 | 15 | ||
13 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
14 | 17 | ||
15 | ---------------------------------------------------------------- | 18 | Vladimir Sementsov-Ogievskiy (1): |
19 | block/io: fix bdrv_co_do_copy_on_readv | ||
16 | 20 | ||
17 | Daniel P. Berrange (1): | 21 | block/io.c | 2 +- |
18 | os: don't corrupt pre-existing memory-backend data with prealloc | 22 | 1 file changed, 1 insertion(+), 1 deletion(-) |
19 | |||
20 | util/oslib-posix.c | 14 +++++++++++++- | ||
21 | 1 file changed, 13 insertions(+), 1 deletion(-) | ||
22 | 23 | ||
23 | -- | 24 | -- |
24 | 2.9.3 | 25 | 2.24.1 |
25 | 26 | ||
26 | diff view generated by jsdifflib |
1 | From: "Daniel P. Berrange" <berrange@redhat.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | When using a memory-backend object with prealloc turned on, QEMU | 3 | Prior to 1143ec5ebf4 it was OK to qemu_iovec_from_buf() from aligned-up |
4 | will memset() the first byte in every memory page to zero. While | 4 | buffer to original qiov, as qemu_iovec_from_buf() will stop at qiov end |
5 | this might have been acceptable for memory backends associated | 5 | anyway. |
6 | with RAM, this corrupts application data for NVDIMMs. | ||
7 | 6 | ||
8 | Instead of setting every page to zero, read the current byte | 7 | But after 1143ec5ebf4 we assume that bdrv_co_do_copy_on_readv works on |
9 | value and then just write that same value back, so we are not | 8 | part of original qiov, defined by qiov_offset and bytes. So we must not |
10 | corrupting the original data. Directly write the value instead | 9 | touch qiov behind qiov_offset+bytes bound. Fix it. |
11 | of memset()ing it, since there's no benefit to memset for a | ||
12 | single byte write. | ||
13 | 10 | ||
14 | Signed-off-by: Daniel P. Berrange <berrange@redhat.com> | 11 | Cc: qemu-stable@nongnu.org # v4.2 |
15 | Reviewed-by: Andrea Arcangeli <aarcange@redhat.com> | 12 | Fixes: 1143ec5ebf4 |
16 | Message-id: 20170303113255.28262-1-berrange@redhat.com | 13 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
14 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
15 | Message-id: 20200312081949.5350-1-vsementsov@virtuozzo.com | ||
17 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 16 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
18 | --- | 17 | --- |
19 | util/oslib-posix.c | 14 +++++++++++++- | 18 | block/io.c | 2 +- |
20 | 1 file changed, 13 insertions(+), 1 deletion(-) | 19 | 1 file changed, 1 insertion(+), 1 deletion(-) |
21 | 20 | ||
22 | diff --git a/util/oslib-posix.c b/util/oslib-posix.c | 21 | diff --git a/block/io.c b/block/io.c |
23 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/util/oslib-posix.c | 23 | --- a/block/io.c |
25 | +++ b/util/oslib-posix.c | 24 | +++ b/block/io.c |
26 | @@ -XXX,XX +XXX,XX @@ static void *do_touch_pages(void *arg) | 25 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child, |
27 | memset_thread_failed = true; | 26 | if (!(flags & BDRV_REQ_PREFETCH)) { |
28 | } else { | 27 | qemu_iovec_from_buf(qiov, qiov_offset + progress, |
29 | for (i = 0; i < numpages; i++) { | 28 | bounce_buffer + skip_bytes, |
30 | - memset(addr, 0, 1); | 29 | - pnum - skip_bytes); |
31 | + /* | 30 | + MIN(pnum - skip_bytes, bytes - progress)); |
32 | + * Read & write back the same value, so we don't | 31 | } |
33 | + * corrupt existing user/app data that might be | 32 | } else if (!(flags & BDRV_REQ_PREFETCH)) { |
34 | + * stored. | 33 | /* Read directly into the destination */ |
35 | + * | ||
36 | + * 'volatile' to stop compiler optimizing this away | ||
37 | + * to a no-op | ||
38 | + * | ||
39 | + * TODO: get a better solution from kernel so we | ||
40 | + * don't need to write at all so we don't cause | ||
41 | + * wear on the storage backing the region... | ||
42 | + */ | ||
43 | + *(volatile char *)addr = *addr; | ||
44 | addr += hpagesize; | ||
45 | } | ||
46 | } | ||
47 | -- | 34 | -- |
48 | 2.9.3 | 35 | 2.24.1 |
49 | 36 | ||
50 | diff view generated by jsdifflib |