From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=52683 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ob9la-0008Gu-3N for qemu-devel@nongnu.org; Tue, 20 Jul 2010 06:09:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ob9lZ-0000Bd-7A for qemu-devel@nongnu.org; Tue, 20 Jul 2010 06:09:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23425) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ob9lY-0000BQ-W9 for qemu-devel@nongnu.org; Tue, 20 Jul 2010 06:09:37 -0400 Message-ID: <4C4575DB.1090001@redhat.com> Date: Tue, 20 Jul 2010 12:09:31 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1279563901-28590-1-git-send-email-miguel.filho@gmail.com> In-Reply-To: <1279563901-28590-1-git-send-email-miguel.filho@gmail.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH v2] loadvm: improve tests before bdrv_snapshot_goto() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Miguel Di Ciurcio Filho Cc: qemu-devel@nongnu.org, lcapitulino@redhat.com Am 19.07.2010 20:25, schrieb Miguel Di Ciurcio Filho: > This patch improves the resilience of the load_vmstate() function, doing > further and better ordered tests. > > In load_vmstate(), if there is any error on bdrv_snapshot_goto(), except if the > error is on VM state device, load_vmstate() will return zero and the VM will be > started with major corruption chances. > > The current process: > - test if there is any writable device without snapshot support > - if exists return -error > - get the device that saves the VM state, possible return -error but unlikely > because it was tested earlier > - flush I/O > - run bdrv_snapshot_goto() on devices > - if fails, give an warning and goes to the next (not good!) > - if fails on the VM state device, return zero (not good!) > - check if the requested snapshot exists on the device that saves the VM state > and the state is not zero > - if fails return -error > - open the file with the VM state > - if fails return -error > - load the VM state > - if fails return -error > - return zero > > New behavior: > - get the device that saves the VM state > - if fails return -error > - check if the requested snapshot exists on the device that saves the VM state > and the state is not zero > - if fails return -error > - test if there is any writable device without snapshot support > - if exists return -error > - test if the devices with snapshot support have the requested snapshot > - if anyone fails, return -error > - flush I/O > - run snapshot_goto() on devices > - if anyone fails, return -error > - open the file with the VM state > - if fails return -error > - load the VM state > - if fails return -error > - return zero > > do_loadvm must not call vm_start if any error has occurred in load_vmstate. > > Changelog from v1 > --------------- > - Use -ENOTSUP instead of -EINVAL when no device supports snapshots > - Split the verification of the existance of an snapshot on the VM state device > and the verification of the size of the saved VM state > > Signed-off-by: Miguel Di Ciurcio Filho Thanks, applied to the block branch. Kevin