[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 11/17] migration/qemu-file: Fix qemu_ftell() for non-writable
From: |
nikita . lapshin |
Subject: |
[PATCH v3 11/17] migration/qemu-file: Fix qemu_ftell() for non-writable file |
Date: |
Thu, 16 Jun 2022 13:28:05 +0300 |
From: Nikita Lapshin <nikita.lapshin@openvz.org>
qemu_ftell() will return wrong value for non-writable QEMUFile.
This happens due to call qemu_fflush() inside qemu_ftell(), this
function won't flush if file is readable.
Signed-off-by: Nikita Lapshin <nikita.lapshin@openvz.org>
---
migration/qemu-file.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 1479cddad9..53ccef80ac 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -663,7 +663,8 @@ int64_t qemu_ftell_fast(QEMUFile *f)
int64_t qemu_ftell(QEMUFile *f)
{
qemu_fflush(f);
- return f->pos;
+ /* Consider that qemu_fflush() won't work if file is non-writable */
+ return f->pos + f->buf_index;
}
int qemu_file_rate_limit(QEMUFile *f)
--
2.31.1
- [PATCH v3 00/17] migration/snapshot: External snapshot utility, nikita . lapshin, 2022/06/16
- [PATCH v3 01/17] migration: Implemented new parameter stream_content, nikita . lapshin, 2022/06/16
- [PATCH v3 02/17] migration: should_skip() implemented, nikita . lapshin, 2022/06/16
- [PATCH v3 03/17] migration: Add vmstate part of migration stream, nikita . lapshin, 2022/06/16
- [PATCH v3 05/17] migration: Add block part of migration stream, nikita . lapshin, 2022/06/16
- [PATCH v3 06/17] migration: Add RAM part of migration stream, nikita . lapshin, 2022/06/16
- [PATCH v3 07/17] migration: analyze-migration script changed, nikita . lapshin, 2022/06/16
- [PATCH v3 08/17] migration: Test for RAM and vmstate parts, nikita . lapshin, 2022/06/16
- [PATCH v3 11/17] migration/qemu-file: Fix qemu_ftell() for non-writable file,
nikita . lapshin <=
- [PATCH v3 13/17] migration/snapshot: Block layer support in qemu-snapshot, nikita . lapshin, 2022/06/16
- [PATCH v3 14/17] migration/snpashot: Implement API for RAMBlock, nikita . lapshin, 2022/06/16
- [PATCH v3 04/17] migration: Add dirty-bitmaps part of migration stream, nikita . lapshin, 2022/06/16
- [PATCH v3 09/17] migration/snapshot: Introduce qemu-snapshot tool, nikita . lapshin, 2022/06/16
- [PATCH v3 10/17] migration/snapshot: Build changes for qemu-snapshot-tool, nikita . lapshin, 2022/06/16
- [PATCH v3 12/17] migration/snapshot: Move RAM_SAVE_FLAG_xxx defines to migration/ram.h, nikita . lapshin, 2022/06/16
- [PATCH v3 16/17] migration/snapshot: Precopy load implemented, nikita . lapshin, 2022/06/16
- [PATCH v3 15/17] migration/snapshot: Save part implement, nikita . lapshin, 2022/06/16