* [Qemu-devel] [PATCH for-2.7] char: fix waiting for TLS and telnet connection
@ 2016-08-16 8:33 Marc-André Lureau
2016-08-16 9:19 ` Dennis Luehring
2016-08-16 9:31 ` Daniel P. Berrange
0 siblings, 2 replies; 5+ messages in thread
From: Marc-André Lureau @ 2016-08-16 8:33 UTC (permalink / raw)
To: qemu-devel; +Cc: berrange, dl.soluz, Marc-André Lureau
Since commit d7a04fd7d5008, tcp_chr_wait_connected() was introduced,
so vhost-user could wait until a backend started successfully. In
vhost-user case, the chr socket must be plain unix, and the chr+vhost
setup happens synchronously during qemu startup.
However, with TLS and telnet socket, initial socket setup happens
asynchronously, and s->connected is not set after the socket is
accepted. In order for tcp_chr_wait_connected() to not keep accepting
new connections and proceed with the last accepted socket, it can
check for s->ioc instead.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
qemu-char.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/qemu-char.c b/qemu-char.c
index 8a0ab05..5f82ebb 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3176,7 +3176,9 @@ static int tcp_chr_wait_connected(CharDriverState *chr, Error **errp)
TCPCharDriver *s = chr->opaque;
QIOChannelSocket *sioc;
- while (!s->connected) {
+ /* It can't wait on s->connected, since it is set asynchronously
+ * in TLS and telnet cases, only wait for an accepted socket */
+ while (!s->ioc) {
if (s->is_listen) {
fprintf(stderr, "QEMU waiting for connection on: %s\n",
chr->filename);
--
2.9.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.7] char: fix waiting for TLS and telnet connection
2016-08-16 8:33 [Qemu-devel] [PATCH for-2.7] char: fix waiting for TLS and telnet connection Marc-André Lureau
@ 2016-08-16 9:19 ` Dennis Luehring
2016-08-16 9:31 ` Daniel P. Berrange
1 sibling, 0 replies; 5+ messages in thread
From: Dennis Luehring @ 2016-08-16 9:19 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
you should push that change - can't find it on http://git.qemu.org/qemu.git
Am 16.08.2016 um 10:33 schrieb Marc-André Lureau:
> Since commit d7a04fd7d5008, tcp_chr_wait_connected() was introduced,
> so vhost-user could wait until a backend started successfully. In
> vhost-user case, the chr socket must be plain unix, and the chr+vhost
> setup happens synchronously during qemu startup.
>
> However, with TLS and telnet socket, initial socket setup happens
> asynchronously, and s->connected is not set after the socket is
> accepted. In order for tcp_chr_wait_connected() to not keep accepting
> new connections and proceed with the last accepted socket, it can
> check for s->ioc instead.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> qemu-char.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/qemu-char.c b/qemu-char.c
> index 8a0ab05..5f82ebb 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -3176,7 +3176,9 @@ static int tcp_chr_wait_connected(CharDriverState *chr, Error **errp)
> TCPCharDriver *s = chr->opaque;
> QIOChannelSocket *sioc;
>
> - while (!s->connected) {
> + /* It can't wait on s->connected, since it is set asynchronously
> + * in TLS and telnet cases, only wait for an accepted socket */
> + while (!s->ioc) {
> if (s->is_listen) {
> fprintf(stderr, "QEMU waiting for connection on: %s\n",
> chr->filename);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.7] char: fix waiting for TLS and telnet connection
2016-08-16 8:33 [Qemu-devel] [PATCH for-2.7] char: fix waiting for TLS and telnet connection Marc-André Lureau
2016-08-16 9:19 ` Dennis Luehring
@ 2016-08-16 9:31 ` Daniel P. Berrange
2016-08-16 9:37 ` Marc-André Lureau
2016-08-16 11:16 ` Peter Maydell
1 sibling, 2 replies; 5+ messages in thread
From: Daniel P. Berrange @ 2016-08-16 9:31 UTC (permalink / raw)
To: Marc-André Lureau; +Cc: qemu-devel, dl.soluz
On Tue, Aug 16, 2016 at 12:33:32PM +0400, Marc-André Lureau wrote:
> Since commit d7a04fd7d5008, tcp_chr_wait_connected() was introduced,
> so vhost-user could wait until a backend started successfully. In
> vhost-user case, the chr socket must be plain unix, and the chr+vhost
> setup happens synchronously during qemu startup.
>
> However, with TLS and telnet socket, initial socket setup happens
> asynchronously, and s->connected is not set after the socket is
> accepted. In order for tcp_chr_wait_connected() to not keep accepting
> new connections and proceed with the last accepted socket, it can
> check for s->ioc instead.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> qemu-char.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/qemu-char.c b/qemu-char.c
> index 8a0ab05..5f82ebb 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -3176,7 +3176,9 @@ static int tcp_chr_wait_connected(CharDriverState *chr, Error **errp)
> TCPCharDriver *s = chr->opaque;
> QIOChannelSocket *sioc;
>
> - while (!s->connected) {
> + /* It can't wait on s->connected, since it is set asynchronously
> + * in TLS and telnet cases, only wait for an accepted socket */
> + while (!s->ioc) {
> if (s->is_listen) {
> fprintf(stderr, "QEMU waiting for connection on: %s\n",
> chr->filename);
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
This is a definite must fix for 2.7.0.
Also shows we really badly need unit tests for the chardev stuff :-)
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.7] char: fix waiting for TLS and telnet connection
2016-08-16 9:31 ` Daniel P. Berrange
@ 2016-08-16 9:37 ` Marc-André Lureau
2016-08-16 11:16 ` Peter Maydell
1 sibling, 0 replies; 5+ messages in thread
From: Marc-André Lureau @ 2016-08-16 9:37 UTC (permalink / raw)
To: Daniel P. Berrange; +Cc: Marc-André Lureau, qemu-devel, dl soluz
Hi
----- Original Message -----
> On Tue, Aug 16, 2016 at 12:33:32PM +0400, Marc-André Lureau wrote:
> > Since commit d7a04fd7d5008, tcp_chr_wait_connected() was introduced,
> > so vhost-user could wait until a backend started successfully. In
> > vhost-user case, the chr socket must be plain unix, and the chr+vhost
> > setup happens synchronously during qemu startup.
> >
> > However, with TLS and telnet socket, initial socket setup happens
> > asynchronously, and s->connected is not set after the socket is
> > accepted. In order for tcp_chr_wait_connected() to not keep accepting
> > new connections and proceed with the last accepted socket, it can
> > check for s->ioc instead.
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> > qemu-char.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/qemu-char.c b/qemu-char.c
> > index 8a0ab05..5f82ebb 100644
> > --- a/qemu-char.c
> > +++ b/qemu-char.c
> > @@ -3176,7 +3176,9 @@ static int tcp_chr_wait_connected(CharDriverState
> > *chr, Error **errp)
> > TCPCharDriver *s = chr->opaque;
> > QIOChannelSocket *sioc;
> >
> > - while (!s->connected) {
> > + /* It can't wait on s->connected, since it is set asynchronously
> > + * in TLS and telnet cases, only wait for an accepted socket */
> > + while (!s->ioc) {
> > if (s->is_listen) {
> > fprintf(stderr, "QEMU waiting for connection on: %s\n",
> > chr->filename);
>
> Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
>
> This is a definite must fix for 2.7.0.
>
> Also shows we really badly need unit tests for the chardev stuff :-)
That was my thought too :)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.7] char: fix waiting for TLS and telnet connection
2016-08-16 9:31 ` Daniel P. Berrange
2016-08-16 9:37 ` Marc-André Lureau
@ 2016-08-16 11:16 ` Peter Maydell
1 sibling, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2016-08-16 11:16 UTC (permalink / raw)
To: Daniel P. Berrange; +Cc: Marc-André Lureau, QEMU Developers, dl.soluz
On 16 August 2016 at 10:31, Daniel P. Berrange <berrange@redhat.com> wrote:
> On Tue, Aug 16, 2016 at 12:33:32PM +0400, Marc-André Lureau wrote:
>> Since commit d7a04fd7d5008, tcp_chr_wait_connected() was introduced,
>> so vhost-user could wait until a backend started successfully. In
>> vhost-user case, the chr socket must be plain unix, and the chr+vhost
>> setup happens synchronously during qemu startup.
>>
>> However, with TLS and telnet socket, initial socket setup happens
>> asynchronously, and s->connected is not set after the socket is
>> accepted. In order for tcp_chr_wait_connected() to not keep accepting
>> new connections and proceed with the last accepted socket, it can
>> check for s->ioc instead.
>>
>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> ---
>> qemu-char.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/qemu-char.c b/qemu-char.c
>> index 8a0ab05..5f82ebb 100644
>> --- a/qemu-char.c
>> +++ b/qemu-char.c
>> @@ -3176,7 +3176,9 @@ static int tcp_chr_wait_connected(CharDriverState *chr, Error **errp)
>> TCPCharDriver *s = chr->opaque;
>> QIOChannelSocket *sioc;
>>
>> - while (!s->connected) {
>> + /* It can't wait on s->connected, since it is set asynchronously
>> + * in TLS and telnet cases, only wait for an accepted socket */
>> + while (!s->ioc) {
>> if (s->is_listen) {
>> fprintf(stderr, "QEMU waiting for connection on: %s\n",
>> chr->filename);
>
> Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
>
> This is a definite must fix for 2.7.0.
>
> Also shows we really badly need unit tests for the chardev stuff :-)
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-08-16 11:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-16 8:33 [Qemu-devel] [PATCH for-2.7] char: fix waiting for TLS and telnet connection Marc-André Lureau
2016-08-16 9:19 ` Dennis Luehring
2016-08-16 9:31 ` Daniel P. Berrange
2016-08-16 9:37 ` Marc-André Lureau
2016-08-16 11:16 ` Peter Maydell
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.