Received: from eggs.gnu.org ([2001:4830:134:3::10]:50518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WlDut-0005sW-K7 for qemu-devel@nongnu.org; Fri, 16 May 2014 04:55:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WlDuo-0003Ft-IC for qemu-devel@nongnu.org; Fri, 16 May 2014 04:54:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40575) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WlDuo-0003Fn-AC for qemu-devel@nongnu.org; Fri, 16 May 2014 04:54:54 -0400 From: Markus Armbruster References: <1399996972-23429-1-git-send-email-armbru@redhat.com> <1399996972-23429-15-git-send-email-armbru@redhat.com> <53750E85.1080006@redhat.com> <878uq225ci.fsf@blackfin.pond.sub.org> Date: Fri, 16 May 2014 10:54:49 +0200 In-Reply-To: <878uq225ci.fsf@blackfin.pond.sub.org> (Markus Armbruster's message of "Thu, 15 May 2014 21:45:49 +0200") Message-ID: <878uq2qf1i.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain 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: Eric Blake Cc: kwolf@redhat.com, MORITA Kazutaka , qemu-devel@nongnu.org, stefanha@redhat.com Markus Armbruster writes: > Eric Blake writes: > >> 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(-) >>> >>> @@ -1568,13 +1565,15 @@ static int sd_prealloc(const char *filename) >>> */ >>> ret = bdrv_pread(bs, idx * SD_DATA_OBJ_SIZE, buf, SD_DATA_OBJ_SIZE); >>> if (ret < 0) { >>> - goto out; >>> + goto out_setg; >>> } >>> ret = bdrv_pwrite(bs, idx * SD_DATA_OBJ_SIZE, buf, SD_DATA_OBJ_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? > > You're right, will fix, thanks! I went over the whole series again looking for similar mistakes, and found a few in PATCH 04 and 17. Respin coming.