From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wl0sH-0003yX-VR for qemu-devel@nongnu.org; Thu, 15 May 2014 14:59:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wl0sD-0002wM-Ey for qemu-devel@nongnu.org; Thu, 15 May 2014 14:59:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wl0sD-0002wE-5i for qemu-devel@nongnu.org; Thu, 15 May 2014 14:59:21 -0400 Message-ID: <53750E85.1080006@redhat.com> Date: Thu, 15 May 2014 12:59:17 -0600 From: Eric Blake MIME-Version: 1.0 References: <1399996972-23429-1-git-send-email-armbru@redhat.com> <1399996972-23429-15-git-send-email-armbru@redhat.com> In-Reply-To: <1399996972-23429-15-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="wXWQbgJn80xtfkt9dB5dePvu3Rs8GIQCS" Subject: Re: [Qemu-devel] [PATCH 14/18] block/sheepdog: Propagate errors through sd_prealloc() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, MORITA Kazutaka This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --wXWQbgJn80xtfkt9dB5dePvu3Rs8GIQCS Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 05/13/2014 10:02 AM, Markus Armbruster wrote: > Cc: MORITA Kazutaka > Signed-off-by: Markus Armbruster > --- > block/sheepdog.c | 21 ++++++++++++--------- > 1 file changed, 12 insertions(+), 9 deletions(-) >=20 > @@ -1568,13 +1565,15 @@ static int sd_prealloc(const char *filename) > */ > ret =3D bdrv_pread(bs, idx * SD_DATA_OBJ_SIZE, buf, SD_DATA_OB= J_SIZE); > if (ret < 0) { > - goto out; > + goto out_setg; > } > ret =3D bdrv_pwrite(bs, idx * SD_DATA_OBJ_SIZE, buf, SD_DATA_O= BJ_SIZE); > if (ret < 0) { > - goto out; > + goto out_setg; > } > } > +out_setg: > + error_setg_errno(errp, -ret, "Can't pre-allocate"); This unconditionally sets errp even when the for loop completes normally. Are you sure you want this control flow? Maybe you are missing a 'goto out' prior to the 'out_setg' label? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --wXWQbgJn80xtfkt9dB5dePvu3Rs8GIQCS 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/ iQEcBAEBCAAGBQJTdQ6FAAoJEKeha0olJ0NqauEH/1K+xB8hdr7lZt29ker5xAKt XBYq/kxxN2uzLCzdgl9eA2ryjt0h8zwxo6U8uLDfm3X4ZPRHwYkt3PtaJCp1o31V 8JVda1yhfq8nzLrAaxh2efLnh600jLH0B5kTxdoPzlqj5Ut5e7l/Ta63TqCBpxhG lhMdZpVILpDMkiDR44I3WrRAyGuod4sSmg9kG373ZbC4UZIUleElmtDeuDPO+8wz cUYjEroTYnmUaE5BBLIVBsGUAZmmNIxkdiViNqmW1goBe7497E2QWvSO76NCUy6T 6W+wvxW7t6B8CLOjj0pEU3xNNn/KltWAeu88kvLSKaQQ+UbJqkMfsUCivglVSd0= =04Dz -----END PGP SIGNATURE----- --wXWQbgJn80xtfkt9dB5dePvu3Rs8GIQCS--