[CRIU] Re: [PATCH cr 6/6] restore: restore pocesses which share one
fdtable
Andrew Vagin
avagin at gmail.com
Tue Oct 2 15:48:16 EDT 2012
> > - if (prepare_fds(current))
> > - return -1;
> > + list_for_each_entry(child, ¤t->children, list) {
> > + if (child->state == TASK_HELPER)
> > + continue;
> > + futex_wait_while_lt(&child->rst->fdt_lock, FDT_LOCK_SYNC);
Here we are waiting while all children. It's incorrect, because we should wait
only children who share fdtable. I will fix that.
> > + }
> > + futex_set_and_wake(¤t->rst->fdt_lock, FDT_LOCK_SYNC);
A child wakes up a parent, that it is waiting fdtable and doing nothing else.
The child can not use file descriptors while fdtable is restored, so we
need this synchronization.
> > +
> > + if (!shared_fdtable(current)) {
> > + if (prepare_fds(current))
> > + return -1;
> > + } else
> > + futex_wait_while_lt(¤t->parent->rst->fdt_lock, FDT_LOCK_DONE);
Here we are waiting while fdtable is restored.
> > + futex_set_and_wake(¤t->rst->fdt_lock, FDT_LOCK_DONE);
fdtable was restored, children can continue
>
> This looks too complicated and not correct. Plz, explain what is going on here.
>
> > if (prepare_fs(pid))
> > return -1;
More information about the CRIU
mailing list