From: "Daniel P. Berrange" <berrange@redhat.com>
To: "Denis V. Lunev" <den@openvz.org>
Cc: qemu-devel@nongnu.org, Denis Plotnikov <dplotnikov@virtuozzo.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 1/1] qemu-nbd: add the option to use pre-created server socket
Date: Tue, 4 Oct 2016 12:09:44 +0100 [thread overview]
Message-ID: <20161004110944.GF5578@redhat.com> (raw)
In-Reply-To: <1475578981-24126-1-git-send-email-den@openvz.org>
On Tue, Oct 04, 2016 at 02:03:01PM +0300, Denis V. Lunev wrote:
> From: Denis Plotnikov <dplotnikov@virtuozzo.com>
>
> The NBD server socket was created by qemu-nbd code. This could lead to the
> race issue when the management layer started qemu-nbd server and allowed
> a client to connect to the server, the client tried to connect to the
> server but failed because qemu-nbd had not managed to open the listening
> server socket by the time the client has finished its trying to connect.
>
> Creating a listening socket before starting of qemu-ndb and passing the
> socket fd to be used as the server socket to qemu-nbd as an option solves
> this issue.
>
> It also helps to resolve the situation when qemu-nbd started by some
> management software should report the port number qemu-nbd bound to, to
> another piece of software. Right now, there is no good way to do that
> except to start the qemu-nbd to make sure that the certain port has been
> actually aquired. Otherwise, it is definitely racy to try to define the
> port first and then start the qemu-nbd, hoping that the port defined is
> still available. Passing of the pre-created file descriptor resolves this
> situation as well.
>
> As a plus, pre-creating of the server socket adds some degree of freedom in
> setting of the socket properties. It is so, because once qemu-nbd gets
> the socket fd, it starts using it as is, without any additional
> modifications.
>
> Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
> Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> ---
> qemu-nbd.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
> qemu-nbd.texi | 6 ++++
> 2 files changed, 89 insertions(+), 12 deletions(-)
>
> Changes from v1:
> - commit message improvements
> - Eric's style nits applied
It seems you've ignored the suggestion to implement the systemd socket
activation protocol, which would avoid the need for any new command
line parameters, and would let qemu-nbd "just work" with systemd units
too.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|
next prev parent reply other threads:[~2016-10-04 11:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-04 11:03 [Qemu-devel] [PATCH v2 1/1] qemu-nbd: add the option to use pre-created server socket Denis V. Lunev
2016-10-04 11:09 ` Daniel P. Berrange [this message]
2016-10-04 11:15 ` Denis V. Lunev
2016-10-04 11:13 ` Denis V. Lunev
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=20161004110944.GF5578@redhat.com \
--to=berrange@redhat.com \
--cc=den@openvz.org \
--cc=dplotnikov@virtuozzo.com \
--cc=pbonzini@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.