From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDrsm-0003ov-Jp for qemu-devel@nongnu.org; Thu, 13 Feb 2014 03:43:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WDrsg-0003YH-Jb for qemu-devel@nongnu.org; Thu, 13 Feb 2014 03:42:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:14578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDrsg-0003YD-Bu for qemu-devel@nongnu.org; Thu, 13 Feb 2014 03:42:50 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1D8gm9M007739 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 13 Feb 2014 03:42:49 -0500 Date: Thu, 13 Feb 2014 09:41:45 +0100 From: Kevin Wolf Message-ID: <20140213084145.GE32343@dhcp-200-207.str.redhat.com> References: <6994360a48564c05021509bf10dbe472ba7f61d6.1392234225.git.jcody@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6994360a48564c05021509bf10dbe472ba7f61d6.1392234225.git.jcody@redhat.com> Subject: Re: [Qemu-devel] [PATCH] block: mirror - insure that errp is not NULL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody Cc: famz@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, armbru@redhat.com Am 12.02.2014 um 20:46 hat Jeff Cody geschrieben: > When starting a block job, commit_active_start() relies on whether *errp > is set by mirror_start_job. This allows it to determine if the mirror > job start failed, so that it can clean up any changes to open flags from > the bdrv_reopen(). If errp is NULL, then it will not be able to > determine if mirror_start_job failed or not. > > Reported-by: Markus Armbruster > Signed-off-by: Jeff Cody > --- > block/mirror.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/block/mirror.c b/block/mirror.c > index 2a43334..41bb83c 100644 > --- a/block/mirror.c > +++ b/block/mirror.c > @@ -634,6 +634,8 @@ void commit_active_start(BlockDriverState *bs, BlockDriverState *base, > int64_t length, base_length; > int orig_base_flags; > > + assert(errp != NULL); > + > orig_base_flags = bdrv_get_flags(base); > > if (bdrv_reopen(base, bs->open_flags, errp)) { This is surprising behaviour. Without looking at the function implementation, I expect that errp == NULL works and means the same as everywhere else: The caller doesn't care about errors. I wouldn't mind if violators were detected at compile time, but this is merely a run-time error (and strictly speaking only an error at all without NDEBUG), so I would prefer to use the normal local_err pattern. Kevin