|
From: | Eric Blake |
Subject: | Re: [PATCH 2/3] mirror: Make sure that source and target size match |
Date: | Thu, 7 May 2020 10:13:29 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
On 5/7/20 9:52 AM, Kevin Wolf wrote:
If the target is shorter than the source, mirror would copy data until it reaches the end of the target and then fail with an I/O error when trying to write past the end. If the target is longer than the source, the mirror job would complete successfully, but the target wouldn't actually be an accurate copy of the source image (it would contain some additional garbage at the end). Fix this by checking that both images have the same size when the job starts. Signed-off-by: Kevin Wolf <address@hidden> --- block/mirror.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
An alternative would be trying to resize the target (like we have to do with active commit), but I'm fine with being conservative for now by forcing the user to have correct sizing, where we have the option to add magic resizing later only if it proves useful and not introducing more potential issues.
Reviewed-by: Eric Blake <address@hidden> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |