From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjtGK-0006ks-3f for qemu-devel@nongnu.org; Mon, 12 May 2014 12:39:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WjtGE-0005qN-EA for qemu-devel@nongnu.org; Mon, 12 May 2014 12:39:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12839) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjtGE-0005qE-5r for qemu-devel@nongnu.org; Mon, 12 May 2014 12:39:30 -0400 Message-ID: <5370F93F.3040001@redhat.com> Date: Mon, 12 May 2014 10:39:27 -0600 From: Eric Blake MIME-Version: 1.0 References: <1399647772-4402-1-git-send-email-ncmike@ncultra.org> In-Reply-To: <1399647772-4402-1-git-send-email-ncmike@ncultra.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Lt4sstpHorjnnXiVII1BHXHnOFi66DgAR" Subject: Re: [Qemu-devel] [PATCH] qemu-img fails to delete last snapshot List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mike Day , qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Lt4sstpHorjnnXiVII1BHXHnOFi66DgAR Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 05/09/2014 09:02 AM, Mike Day wrote: > When deleting the last snapshot, copying the resulting snapshot table > currently fails, causing the delete operation to also fail. Fix the > failure by skipping the copy and just writing the snapshot header and > freeing the extra clusters. >=20 > Signed-off-by: Mike Day > --- >=20 > There are two specific problems in the curent code. First is a lack of s/curent/current/ > parenthesis in the calculation of a memmove parameter: >=20 > s->nb_snapshots - snapshot_index - 1 >=20 > When s->nb_snapshots is 0, snapshot_index is 1.=20 >=20 > 0 - 1 - 1 =3D 0xfffffffe >=20 > it should be: >=20 > 0 - (1 - 1) =3D 0x00 >=20 > The second problem is shifting the snapshot table to the left. After > removing the last snapshot there are no existing snapshots to be > shifted. All that needs to be done is to write the header and > unallocate the blocks. This information is actually quite useful in understanding the patch, and I would have included it prior to the --- for inclusion in git, rather than in the reviewer-only commentary that gets stripped during 'git am'. >=20 > block/qcow2-snapshot.c | 25 +++++++++++++++---------- > 1 file changed, 15 insertions(+), 10 deletions(-) I'd suggest posting a v2 with a better commit message; but the code itself seems fine, so you can add: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Lt4sstpHorjnnXiVII1BHXHnOFi66DgAR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTcPk/AAoJEKeha0olJ0NqQQ8H/1Rkg6DBENPaVAkDhlNs/jZd g9PYn1nG9MllMcKc/h69E5lD7sLr5AomJ3WSr+j3QsDCdtkc+jo1RmRiRiHUG6Ge 8Q7jdxNVIPfUx56QHGfxpLFaFMCyVHyLIXLDTx2ToFLXzHFkqw0edXMOweD4yI7M yhbas9W3kC3Muup9WFKmbpVf66SoT+Vf+PA9U+G0YlI7u2Gyqn7WT01Qo8LmO6e/ dqkrr53RNrnp9AZ23taSFjMmdqbK1RORHxO44Mmi1taP3F8xp5Swz9iP75zBMGXd LCxNYdHnomNWopiRjqa5c8SGYOVzQzwbOMZilm4nPLRDERPxq4aMEGylufxBUls= =pMIq -----END PGP SIGNATURE----- --Lt4sstpHorjnnXiVII1BHXHnOFi66DgAR--