From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Lukas Straub <lukasstraub2@web.de>
Cc: "Kevin Wolf" <kwolf@redhat.com>,
qemu-block <qemu-block@nongnu.org>,
"Juan Quintela" <quintela@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>,
"Max Reitz" <mreitz@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [PATCH 3/5] block/nbd.c: Add yank feature
Date: Fri, 15 May 2020 11:26:13 +0100 [thread overview]
Message-ID: <20200515102613.GI1300305@redhat.com> (raw)
In-Reply-To: <20200515121447.60bbd80d@luklap>
On Fri, May 15, 2020 at 12:14:47PM +0200, Lukas Straub wrote:
> On Fri, 15 May 2020 11:04:13 +0100
> Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> > On Fri, May 15, 2020 at 11:48:18AM +0200, Lukas Straub wrote:
> > > On Tue, 12 May 2020 09:54:58 +0100
> > > Daniel P. Berrangé <berrange@redhat.com> wrote:
> > >
> > > > On Mon, May 11, 2020 at 07:05:24PM +0200, Lukas Straub wrote:
> > > > > On Mon, 11 May 2020 17:19:09 +0100
> > > > > "Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> > > > >
> > > > > > * Lukas Straub (lukasstraub2@web.de) wrote:
> > > > > > > Add yank option, pass it to the socket-channel and register a yank
> > > > > > > function which sets s->state = NBD_CLIENT_QUIT. This is the same
> > > > > > > behaviour as if an error occured.
> > > > > > >
> > > > > > > Signed-off-by: Lukas Straub <lukasstraub2@web.de>
> > > > > >
> > > > > > > +static void nbd_yank(void *opaque)
> > > > > > > +{
> > > > > > > + BlockDriverState *bs = opaque;
> > > > > > > + BDRVNBDState *s = (BDRVNBDState *)bs->opaque;
> > > > > > > +
> > > > > > > + atomic_set(&s->state, NBD_CLIENT_QUIT);
> > > > > >
> > > > > > I think I was expecting a shutdown on the socket here - why doesn't it
> > > > > > have one?
> > > > >
> > > > > For nbd, we register two yank functions: This one and we enable
> > > > > the yank feature on the qio channel (see function
> > > > > nbd_establish_connection below).
> > > >
> > > > As mentioned on the earlier patch, I don't want to see any yank
> > > > code in the QIOChannel object directly. This nbd_yank function
> > > > can simply call the qio_channel_shutdown() function directly
> > > > and avoid need for modifying the QIOChannel object with yank
> > > > support.
> > >
> > > Hi,
> > > Looking at it again, the problem is not with registering the yank functions, but with tracking the lifetime of it. Suppose we add qio_channel_shutdown to the yank_nbd function. Then we need to unregister it whenever the QIOChannel object is freed.
> > >
> > > In the code that would lead to the following constructs in a lot of places:
> > > if (local_err) {
> > > yank_unregister_function(s->yank_name, yank_nbd, bs);
> > > object_unref(OBJECT(sioc));
> > > error_propagate(errp, local_err);
> > > return NULL;
> > > }
> >
> > The nbd patch here already has a yank_unregister_function() so I'm
> > not seeing anything changes in that respect. The "yank_nbd" function
> > should check that the I/O channel is non-NULL before calling the
> > qio_channel_shutdown method.
>
> Hmm, but if object_unref frees the object, it doesn't set the
> pointer to NULL does it?
So set "ioc = NULL" after calling object_unref. AFAICT, nbd already
does exactly this.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2020-05-15 10:27 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-11 11:14 [PATCH 0/5] Introduce 'yank' oob qmp command to recover from hanging qemu Lukas Straub
2020-05-11 11:14 ` [PATCH 1/5] Introduce yank feature Lukas Straub
2020-05-11 11:14 ` [PATCH 2/5] io/channel.c,io/channel-socket.c: Add " Lukas Straub
2020-05-11 11:51 ` Daniel P. Berrangé
2020-05-11 20:00 ` Lukas Straub
2020-05-12 8:52 ` Daniel P. Berrangé
2020-05-11 11:14 ` [PATCH 3/5] block/nbd.c: " Lukas Straub
2020-05-11 16:19 ` Dr. David Alan Gilbert
2020-05-11 17:05 ` Lukas Straub
2020-05-11 17:24 ` Dr. David Alan Gilbert
2020-05-12 8:54 ` Daniel P. Berrangé
2020-05-15 9:48 ` Lukas Straub
2020-05-15 10:04 ` Daniel P. Berrangé
2020-05-15 10:14 ` Lukas Straub
2020-05-15 10:26 ` Daniel P. Berrangé [this message]
2020-05-15 13:03 ` Lukas Straub
2020-05-15 13:45 ` Daniel P. Berrangé
2020-05-11 11:14 ` [PATCH 4/5] chardev/char-socket.c: " Lukas Straub
2020-05-12 8:56 ` Daniel P. Berrangé
2020-05-11 11:14 ` [PATCH 5/5] migration: " Lukas Straub
2020-05-11 11:49 ` [PATCH 0/5] Introduce 'yank' oob qmp command to recover from hanging qemu Daniel P. Berrangé
2020-05-11 12:07 ` Dr. David Alan Gilbert
2020-05-11 12:17 ` Daniel P. Berrangé
2020-05-11 15:46 ` Dr. David Alan Gilbert
2020-05-12 9:32 ` Lukas Straub
2020-05-12 9:43 ` Daniel P. Berrangé
2020-05-12 18:58 ` Dr. David Alan Gilbert
2020-05-13 8:41 ` Daniel P. Berrangé
2020-05-12 19:42 ` Lukas Straub
2020-05-13 10:32 ` Kevin Wolf
2020-05-13 10:53 ` Dr. David Alan Gilbert
2020-05-13 11:13 ` Kevin Wolf
2020-05-13 11:26 ` Daniel P. Berrangé
2020-05-13 11:58 ` Paolo Bonzini
2020-05-13 12:25 ` Dr. David Alan Gilbert
2020-05-13 12:32 ` Kevin Wolf
2020-05-13 12:18 ` Kevin Wolf
2020-05-13 12:56 ` Dr. David Alan Gilbert
2020-05-13 13:08 ` Daniel P. Berrangé
2020-05-13 13:48 ` Dr. David Alan Gilbert
2020-05-13 13:57 ` Eric Blake
2020-05-13 14:06 ` Kevin Wolf
2020-05-13 14:18 ` Eric Blake
2020-09-01 10:35 ` Markus Armbruster
2020-05-11 19:41 ` Lukas Straub
2020-05-11 18:12 ` Lukas Straub
2020-05-12 9:03 ` Daniel P. Berrangé
2020-05-12 9:06 ` Dr. David Alan Gilbert
2020-05-12 9:09 ` Dr. David Alan Gilbert
2020-05-13 19:12 ` Lukas Straub
2020-05-14 10:41 ` Kevin Wolf
2020-05-14 11:01 ` Dr. David Alan Gilbert
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=20200515102613.GI1300305@redhat.com \
--to=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=kwolf@redhat.com \
--cc=lukasstraub2@web.de \
--cc=marcandre.lureau@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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).