qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] hostmem-file: add a property 'notrunc' to avoid


From: Haozhong Zhang
Subject: Re: [Qemu-devel] [PATCH] hostmem-file: add a property 'notrunc' to avoid data corruption
Date: Thu, 20 Oct 2016 21:33:53 +0800
User-agent: NeoMutt/20160827 (1.7.0)

On 10/20/16 11:21 -0200, Eduardo Habkost wrote:
On Thu, Oct 20, 2016 at 02:34:12PM +0200, Igor Mammedov wrote:
On Thu, 20 Oct 2016 14:13:01 +0800
Haozhong Zhang <address@hidden> wrote:

> If a file is used as the backend of memory-backend-file and its size is
> not identical to the property 'size', the file will be truncated. For a
> file used as the backend of vNVDIMM, its data is expected to be
> persistent and the truncation may corrupt the existing data.
I wonder if it's possible just skip 'size' property in your case instead
'notrunc' property. That way if size is not present one'd get actual size
using get_file_size() and set 'size' to it?
And if 'size' is provided and 'size' != file_size then error out.

I think it is valid to start with a zero-size file and then let
QEMU extend it.

For vNVDIMM, extending from zero-size file can be valid when a file is
first used. However, it's not valid for the second and following use
of the same file.

But I agree we should: 1) make 'size' optional as
you suggested; 2) never truncate the file to a smaller size.


I will add another patch for this. Is there any way in QEMU to decide
whether a memory-backend-file object is used for vNVDIMM when the
object is being created? Or 'size' can be optional for all kinds of
usages?

Thanks,
Haozhong



reply via email to

[Prev in Thread] Current Thread [Next in Thread]