qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Merge NBD client/server int qemu-nbd


From: Laurent Vivier
Subject: Re: [Qemu-devel] [PATCH] Merge NBD client/server int qemu-nbd
Date: Fri, 13 Jun 2008 20:39:54 +0200

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.

Because the open() calls /dev/nbd0 which calls through the socket its
parent and IMHO there is no easy way to know if the server is ready to
process the request.

Perhaps something like:

int timeout = 5;
while ((fd = open(device, O_RDWR)) == -1 && timeout--)
    sleep(1);

Any suggestion ???

Regards,
Laurent
-- 
------------- address@hidden ---------------
"The best way to predict the future is to invent it."
- Alan Kay





reply via email to

[Prev in Thread] Current Thread [Next in Thread]