From: "Michael S. Tsirkin" <mst@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: kwolf@redhat.com, qemu-block@nongnu.org, armbru@redhat.com,
Jeff Cody <jcody@redhat.com>, Peter Lieven <pl@kamp.de>,
qemu-devel@nongnu.org, dgilbert@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 3/3] block/nfs: switch to error_init_local
Date: Tue, 23 Jun 2015 11:03:26 +0200 [thread overview]
Message-ID: <20150623105941-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <558192F9.3050001@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 <mst@redhat.com>
> > ---
> > 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
>
next prev parent reply other threads:[~2015-06-23 9:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-17 7:24 [Qemu-devel] [PATCH v2 0/3] error: allow local errors to trigger abort Michael S. Tsirkin
2015-06-17 7:24 ` [Qemu-devel] [PATCH v2 1/3] error: don't rely on pointer comparisons Michael S. Tsirkin
2015-06-17 15:21 ` Eric Blake
2015-06-17 15:41 ` Eric Blake
2015-06-18 15:36 ` Markus Armbruster
2015-06-18 16:10 ` Markus Armbruster
2015-06-17 7:24 ` [Qemu-devel] [PATCH v2 2/3] error: allow local errors to trigger abort Michael S. Tsirkin
2015-06-17 7:24 ` [Qemu-devel] [PATCH v2 3/3] block/nfs: switch to error_init_local Michael S. Tsirkin
2015-06-17 15:32 ` Eric Blake
2015-06-23 9:03 ` Michael S. Tsirkin [this message]
2015-06-18 16:34 ` [Qemu-devel] [PATCH v2 0/3] error: allow local errors to trigger abort Markus Armbruster
2015-06-18 16:49 ` Paolo Bonzini
2015-06-22 11:31 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150623105941-mutt-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).