[CRIU] Re: [PATCH] restore: Order file restoring by their type
Pavel Emelyanov
xemul at parallels.com
Sat Apr 28 11:21:35 EDT 2012
On 04/28/2012 07:20 PM, Cyrill Gorcunov wrote:
> On Sat, Apr 28, 2012 at 06:15:49PM +0400, Cyrill Gorcunov wrote:
>>
>> Anyway, I'll not insist and will add explicit test.
>
> Something like below? (don't apply it yet)
It can be done simpler. At fds collecting stage you can put epoll-s at
the end and of the list all the others at the head of it ;)
> Cyrill
> ---
> From: Cyrill Gorcunov <gorcunov at openvz.org>
> Subject: [PATCH] files: Open eventpoll file descriptors after regular files
>
> epoll might use file descriptors as a source at time of
> restore thus we need epolls to be restored at the very end.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
> files.c | 17 ++++++++++++++++-
> 1 files changed, 16 insertions(+), 1 deletions(-)
>
> diff --git a/files.c b/files.c
> index 2fd4ec0..8f3bd3c 100644
> --- a/files.c
> +++ b/files.c
> @@ -654,12 +654,27 @@ int prepare_fds(struct pstree_item *me)
>
> pr_info("%d: Opening fdinfo-s\n", me->pid);
>
> - for (state = 0; state < FD_STATE_MAX; state++)
> + for (state = 0; state < FD_STATE_MAX; state++) {
> + /*
> + * We need eventpoll files to be restored at
> + * the end, because they assume file descriptors
> + * (found at chekpoint time) are already opened.
> + */
> list_for_each_entry(fle, &me->rst->fds, ps_list) {
> + if (fle->fe.type == FDINFO_EVENTPOLL)
> + continue;
> + ret = open_fdinfo(me->pid, &fle->fe, state);
> + if (ret)
> + goto done;
> + }
> + list_for_each_entry(fle, &me->rst->fds, ps_list) {
> + if (fle->fe.type != FDINFO_EVENTPOLL)
> + continue;
> ret = open_fdinfo(me->pid, &fle->fe, state);
> if (ret)
> goto done;
> }
> + }
>
> ret = run_unix_connections();
> done:
More information about the CRIU
mailing list