Received: from eggs.gnu.org ([2001:4830:134:3::10]:33323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wl1ba-0000lM-5w for qemu-devel@nongnu.org; Thu, 15 May 2014 15:46:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wl1bR-000434-Se for qemu-devel@nongnu.org; Thu, 15 May 2014 15:46:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wl1bR-00042q-Lp for qemu-devel@nongnu.org; Thu, 15 May 2014 15:46:05 -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> Date: Thu, 15 May 2014 21:45:49 +0200 In-Reply-To: <53750E85.1080006@redhat.com> (Eric Blake's message of "Thu, 15 May 2014 12:59:17 -0600") Message-ID: <878uq225ci.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 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!