From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dufyu-00084z-0x for qemu-devel@nongnu.org; Wed, 20 Sep 2017 10:28:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dufyp-0002CQ-US for qemu-devel@nongnu.org; Wed, 20 Sep 2017 10:28:04 -0400 References: <20170920135833.20472-1-pbutsykin@virtuozzo.com> <20170920135833.20472-2-pbutsykin@virtuozzo.com> From: Eric Blake Message-ID: Date: Wed, 20 Sep 2017 09:27:45 -0500 MIME-Version: 1.0 In-Reply-To: <20170920135833.20472-2-pbutsykin@virtuozzo.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WoHFxAR3fPmIc7ep5niifqQPVhOsJLI62" Subject: Re: [Qemu-devel] [PATCH 1/2] qcow2: fix return error code in qcow2_truncate() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Butsykin , qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: kwolf@redhat.com, mreitz@redhat.com, den@openvz.org, qemu-stable This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --WoHFxAR3fPmIc7ep5niifqQPVhOsJLI62 From: Eric Blake To: Pavel Butsykin , qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: kwolf@redhat.com, mreitz@redhat.com, den@openvz.org, qemu-stable Message-ID: Subject: Re: [PATCH 1/2] qcow2: fix return error code in qcow2_truncate() References: <20170920135833.20472-1-pbutsykin@virtuozzo.com> <20170920135833.20472-2-pbutsykin@virtuozzo.com> In-Reply-To: <20170920135833.20472-2-pbutsykin@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/20/2017 08:58 AM, Pavel Butsykin wrote: > Signed-off-by: Pavel Butsykin > --- > block/qcow2.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Wow, bdrv_truncate() has had problems! You found fixes unrelated to my current struggles to fix the dirty-bitmap failure. Reviewed-by: Eric Blake CC: qemu-stable@nongnu.org >=20 > diff --git a/block/qcow2.c b/block/qcow2.c > index 2174a84d1f..8a4311d338 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c > @@ -3166,7 +3166,7 @@ static int qcow2_truncate(BlockDriverState *bs, i= nt64_t offset, > if (old_file_size < 0) { > error_setg_errno(errp, -old_file_size, > "Failed to inquire current file length");= > - return ret; > + return old_file_size; > } > =20 > nb_new_data_clusters =3D DIV_ROUND_UP(offset - old_length, > @@ -3195,7 +3195,7 @@ static int qcow2_truncate(BlockDriverState *bs, i= nt64_t offset, > if (allocation_start < 0) { > error_setg_errno(errp, -allocation_start, > "Failed to resize refcount structures"); > - return -allocation_start; > + return allocation_start; > } > =20 > clusters_allocated =3D qcow2_alloc_clusters_at(bs, allocation_= start, >=20 --=20 Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org --WoHFxAR3fPmIc7ep5niifqQPVhOsJLI62 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEzBAEBCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAlnCeuEACgkQp6FrSiUn Q2peWgf/Xfm2j1/0utZcGkMt0myQpZNz+s8S/38ejrA9UUZthLLTWH9NXVboVRx8 3eSt4fa9rBEmFYW19duFMLH66crH/+RP2/hsA+mKMnWKv2g/BuOeF4/bCPR1rikZ qERYgt7tWIk5xS+2gOngmFsR1qE/kKpP1efjw9Tw5lM0VHOgBXMyOKQkpMP1Qs0a rw9CuEVMNE9wG4iAQnfJ7XS3jTbGJwyb2BxVfFvBSrcoekevCMxANtaSoOrReULK HpkjLQxYWDxMRKqW4GYWotuyTa8z/xV2CtCgipm/GKvcm/2xquYx151UgG+bJtPi xR5eyuRXyQtDppvLV/alVeyxQfsKOw== =NNBW -----END PGP SIGNATURE----- --WoHFxAR3fPmIc7ep5niifqQPVhOsJLI62--