[CRIU] Re: [PATCH 08/14] files: Restore epolls lately

Pavel Emelyanov xemul at parallels.com
Thu May 3 08:55:00 EDT 2012


On 04/29/2012 05:14 PM, Cyrill Gorcunov wrote:
> 
> We need to restore epolls lately since they might
> use sockets/pipes/reg-files.
> 
> For this sake collect_fd splited to two functions,
> collect_fd itself and alloc_fdinfo_list_entry.
> 
> Firstly we allocate fdinfo_list_entry and then
> either collect it immediately if it's not epoll
> file or postpone collecting.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  files.c |   71 +++++++++++++++++++++++++++++++++++++++++++++++----------------
>  1 files changed, 53 insertions(+), 18 deletions(-)
> 

Ah, now I see where the fix for eventpoll restore is.
I believe the fix can be done simpler. Like this:

-static int collect_fd(int pid, struct fdinfo_entry *e, struct list_head *fds)
+static int collect_fd(int pid, struct fdinfo_entry *e, struct list_head *fds, int tail)
...
-list_add_tail(&le->ps_list, fds);
+if (tail)
+      list_add_tail(&le->ps_list, fds);
+else
+      list_add(&le->ps_list, fds);
...
-ret = collect_fd(pid, &e, &rst_info->fds);
+ret = collect_fd(pid, &e, &rst_info->fds, e.type == FDINFO_EVENTPOLL);

And that's it.

Thanks,
Pavel


More information about the CRIU mailing list