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

Re: [libvirt] [PATCH 3/3] nodedev: Work around the uevent race by hooking up virFileWaitForAccess



> > + */
> > +static int
> > +udevWaitForAttrs(const char *sys_path, ...)
> > +{
> > +    int ret = -1;
> > +    const char *attr = NULL;
> > +    char *attr_path = NULL;
> > +    va_list args;
> > +
> > +    va_start(args, sys_path);
> > +    while ((attr = va_arg(args, char *))) {
> > +        if (virAsprintf(&attr_path, "%s/%s", sys_path, attr) < 0)
> > +            goto cleanup;
> > +
> > +        if (virFileWaitForAccess(attr_path, 100, 10) < 0)
>
> So this waits up to 1 second per file in rather long increments (100
> ms) which I don't think is really desired.
>
> The only prior art here which I think is somewhat relevant is the
> waiting code for netdevs, where a 1 ms timeout with 100 retries is used.
>
> Also note that this will delay the event loop since the function is
> called by udevEventHandleCallback which is registered in the event loop.
> This is definitely unaceptable. NACK to this approach

Oh, I was in a rush writing this and missed that one completely, true, no
blocking in the eventloop, naturally. I'll try a different approach and respin.

Erik


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