From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7K7L-0003GS-HX for qemu-devel@nongnu.org; Tue, 23 Jun 2015 05:03:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7K7F-0007Ew-LN for qemu-devel@nongnu.org; Tue, 23 Jun 2015 05:03:43 -0400 Date: Tue, 23 Jun 2015 11:03:26 +0200 From: "Michael S. Tsirkin" Message-ID: <20150623105941-mutt-send-email-mst@redhat.com> References: <1434525861-21768-1-git-send-email-mst@redhat.com> <1434525861-21768-4-git-send-email-mst@redhat.com> <558192F9.3050001@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <558192F9.3050001@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 3/3] block/nfs: switch to error_init_local List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, qemu-block@nongnu.org, armbru@redhat.com, Jeff Cody , Peter Lieven , qemu-devel@nongnu.org, dgilbert@redhat.com On Wed, Jun 17, 2015 at 09:32:09AM -0600, Eric Blake wrote: > On 06/17/2015 01:24 AM, Michael S. Tsirkin wrote: > > We probably should just switch everyone, this is > > just to demonstrate the API usage. > > > > Signed-off-by: Michael S. Tsirkin > > --- > > block/nfs.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/block/nfs.c b/block/nfs.c > > index ca9e24e..de4b8c3 100644 > > --- a/block/nfs.c > > +++ b/block/nfs.c > > @@ -385,7 +385,7 @@ static int nfs_file_open(BlockDriverState *bs, QDict *options, int flags, > > NFSClient *client = bs->opaque; > > int64_t ret; > > QemuOpts *opts; > > - Error *local_err = NULL; > > + Error *local_err = error_init_local(errp); > > > > client->aio_context = bdrv_get_aio_context(bs); > > More context: > > > opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); > > qemu_opts_absorb_qdict(opts, options, &local_err); > > if (local_err) { > > error_propagate(errp, local_err); > > ret = -EINVAL; > > Oops. Your initialization means that if the caller passed in > &error_abort, then local_err is now non-NULL, and we will attempt to do > error_propagate(errp, error_abort), which will abort(). You'd have to > change that to > if (!error_is_abort(local_err)) { Looking at the alternatives, this seems like a reasonable change, does it not? Except it's a slightly ugly name, we need a new wrapper if (!error_is_set(local_err)) which does if (!local_err || local_err == &error_abort) internally. > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org >