qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <Laurent.Vivier@bull.net>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Merge NBD client/server int qemu-nbd
Date: Sat, 14 Jun 2008 20:47:13 +0200	[thread overview]
Message-ID: <1213469233.3843.7.camel@frecb07144> (raw)
In-Reply-To: <4853DFDF.7000501@codemonkey.ws>

Le samedi 14 juin 2008 à 10:12 -0500, Anthony Liguori a écrit :
> Laurent Vivier wrote:
> > Le vendredi 13 juin 2008 à 12:49 -0500, Anthony Liguori a écrit :
> >   
> >> Laurent Vivier wrote:
> >>     
> > [...]
> >   
> >>> +static void show_parts(const char *device)
> >>> +{
> >>> +    if (fork() == 0) {
> >>> +        int nbd;
> >>> +
> >>> +	/* wait device */
> >>> +        sleep(1);
> >>>   
> >>>       
> >> This looks like a big red-herring.  What is this sleep waiting for any 
> >> can it be possibly made into something less racy?
> >>     
> >
> > Yes, I know, it's BAD (and it can failed sometime...)
> >
> > But show_parts() must wait its parent has entered in nbd_trip() loop.
> >   
> 
> You mean, listen() has to be called on the fd in the server?  You have 
> two choices I think.  You could wait to fork the child until after 
> you've listen()'d which is probably the most elegant solution.  If 

It is already after the listen (even after the accept...).
It is why I call show_parts() from the server and not from client.

> that's difficult to do, you could have the child inherit one end of a 
> pipe() and use that in the child to wait for the server to be ready.

perhaps I'm wrong, but it seems the server must be waiting on the read()
to allow to have a success on the open(), so I don't see how the server
can launch show_parts() whereas it is already waiting on the read().

Regards,
Laurent
-- 
------------- Laurent.Vivier@bull.net ---------------
"The best way to predict the future is to invent it."
- Alan Kay

  reply	other threads:[~2008-06-14 18:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-13 15:15 [Qemu-devel] [PATCH] Merge NBD client/server int qemu-nbd Laurent Vivier
2008-06-13 17:49 ` Anthony Liguori
2008-06-13 18:09   ` Avi Kivity
2008-06-13 18:39   ` Laurent Vivier
2008-06-14 15:12     ` Anthony Liguori
2008-06-14 18:47       ` Laurent Vivier [this message]
2008-06-14 17:18     ` Avi Kivity
2008-06-14 19:03       ` Laurent Vivier
2008-06-14 19:06         ` Avi Kivity
2008-06-14 19:21           ` Laurent Vivier
2008-06-14 19:35             ` Avi Kivity
2008-06-14 19:54               ` Laurent Vivier
2008-06-15 14:25                 ` Anthony Liguori
2008-06-15 15:56                   ` Laurent Vivier
2008-06-15 16:00                     ` Avi Kivity
2008-06-15 17:39                       ` Laurent Vivier
2008-06-19  8:58                         ` [Qemu-devel] [PATCH][v2] " Laurent Vivier
2008-06-19  9:18                           ` Laurent Vivier

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=1213469233.3843.7.camel@frecb07144 \
    --to=laurent.vivier@bull.net \
    --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).