qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-nbd: drop loop which can never loop
@ 2012-01-05 13:16 Stefan Hajnoczi
  2012-01-05 13:29 ` Paolo Bonzini
  2012-01-06 15:10 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2012-01-05 13:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Paolo Bonzini, Dr David Alan Gilbert,
	Stefan Hajnoczi

For some reason nbd_client_thread() has a do..while loop which can never
loop, the condition is bogus because we would take a goto instead.  Drop
the loop.

Reported-by: Dr David Alan Gilbert <davidagilbert@uk.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 qemu-nbd.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/qemu-nbd.c b/qemu-nbd.c
index 155b058..eb61c33 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -202,12 +202,10 @@ static void *nbd_client_thread(void *arg)
     int ret;
     pthread_t show_parts_thread;
 
-    do {
-        sock = unix_socket_outgoing(sockpath);
-        if (sock == -1) {
-            goto out;
-        }
-    } while (sock == -1);
+    sock = unix_socket_outgoing(sockpath);
+    if (sock == -1) {
+        goto out;
+    }
 
     ret = nbd_receive_negotiate(sock, NULL, &nbdflags,
                                 &size, &blocksize);
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-nbd: drop loop which can never loop
  2012-01-05 13:16 [Qemu-devel] [PATCH] qemu-nbd: drop loop which can never loop Stefan Hajnoczi
@ 2012-01-05 13:29 ` Paolo Bonzini
  2012-01-05 14:22   ` Stefan Hajnoczi
  2012-01-06 15:10 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  1 sibling, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2012-01-05 13:29 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-trivial, qemu-devel, Dr David Alan Gilbert

On 01/05/2012 02:16 PM, Stefan Hajnoczi wrote:
> For some reason nbd_client_thread() has a do..while loop which can never
> loop, the condition is bogus because we would take a goto instead.  Drop
> the loop.
>
> Reported-by: Dr David Alan Gilbert<davidagilbert@uk.ibm.com>
> Signed-off-by: Stefan Hajnoczi<stefanha@linux.vnet.ibm.com>
> ---
>   qemu-nbd.c |   10 ++++------
>   1 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/qemu-nbd.c b/qemu-nbd.c
> index 155b058..eb61c33 100644
> --- a/qemu-nbd.c
> +++ b/qemu-nbd.c
> @@ -202,12 +202,10 @@ static void *nbd_client_thread(void *arg)
>       int ret;
>       pthread_t show_parts_thread;
>
> -    do {
> -        sock = unix_socket_outgoing(sockpath);
> -        if (sock == -1) {
> -            goto out;
> -        }
> -    } while (sock == -1);
> +    sock = unix_socket_outgoing(sockpath);
> +    if (sock == -1) {
> +        goto out;
> +    }
>
>       ret = nbd_receive_negotiate(sock, NULL,&nbdflags,
>                                   &size,&blocksize);

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

It used to loop until commit f1ef555.  When I simplified the loop I 
failed to actually remove it.

I suppose it will get in through your trivial patches tree, won't it?

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-nbd: drop loop which can never loop
  2012-01-05 13:29 ` Paolo Bonzini
@ 2012-01-05 14:22   ` Stefan Hajnoczi
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2012-01-05 14:22 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: qemu-trivial, Dr David Alan Gilbert, Stefan Hajnoczi, qemu-devel

On Thu, Jan 5, 2012 at 1:29 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> I suppose it will get in through your trivial patches tree, won't it?

Yes

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] qemu-nbd: drop loop which can never loop
  2012-01-05 13:16 [Qemu-devel] [PATCH] qemu-nbd: drop loop which can never loop Stefan Hajnoczi
  2012-01-05 13:29 ` Paolo Bonzini
@ 2012-01-06 15:10 ` Stefan Hajnoczi
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2012-01-06 15:10 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: qemu-trivial, Paolo Bonzini, qemu-devel, Dr David Alan Gilbert

On Thu, Jan 05, 2012 at 01:16:07PM +0000, Stefan Hajnoczi wrote:
> For some reason nbd_client_thread() has a do..while loop which can never
> loop, the condition is bogus because we would take a goto instead.  Drop
> the loop.
> 
> Reported-by: Dr David Alan Gilbert <davidagilbert@uk.ibm.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> ---
>  qemu-nbd.c |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)

Applied to the trivial patches -next tree:
https://github.com/stefanha/qemu/commits/trivial-patches-next

Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-06 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-05 13:16 [Qemu-devel] [PATCH] qemu-nbd: drop loop which can never loop Stefan Hajnoczi
2012-01-05 13:29 ` Paolo Bonzini
2012-01-05 14:22   ` Stefan Hajnoczi
2012-01-06 15:10 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi

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).