[CRIU] [PATCH v2 14/28] files: Kill fd_open_state::receive_fd stage
Pavel Emelyanov
xemul at virtuozzo.com
Mon Dec 5 02:02:57 PST 2016
On 11/30/2016 07:31 PM, Kirill Tkhai wrote:
> Since "receive" stage is used only for slave fds
> and nobody depends on slave fds receiving is finished,
> we may move it functionality in "post_open" stage.
> This just makes slave fds to be received a little bit later.
This requires clarification.
Consider we have files A and B in current.
Before the patch the opening of them looked like
A->open
B->open
A->recv
B->recv
A->post_open
B->post_open
now it is like
A->open
B->open
A->recv
A->post_open
B->recv
B->post_open
Where did we remove the dependency between A->post_open and B->recv ?
-- Pavel
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
> criu/files.c | 22 +++++++++-------------
> 1 file changed, 9 insertions(+), 13 deletions(-)
>
> diff --git a/criu/files.c b/criu/files.c
> index 8a07da6..23ff3f9 100644
> --- a/criu/files.c
> +++ b/criu/files.c
> @@ -865,7 +865,6 @@ static int post_open_fd(int pid, struct fdinfo_list_entry *fle);
>
> static struct fd_open_state states[] = {
> { "create", open_fd, },
> - { "receive", receive_fd, },
> { "post_create", post_open_fd, },
> };
>
> @@ -971,15 +970,17 @@ static int post_open_fd(int pid, struct fdinfo_list_entry *fle)
> {
> struct file_desc *d = fle->desc;
>
> - if (!d->ops->post_open)
> - return 0;
> -
> - if (is_service_fd(fle->fe->fd, CTL_TTY_OFF))
> - return d->ops->post_open(d, fle->fe->fd);
> + if (fle != file_master(d)) {
> + if (receive_fd(pid, fle) < 0) {
> + pr_err("Can't receive\n");
> + return -1;
> + }
> + if (!is_service_fd(fle->fe->fd, CTL_TTY_OFF))
> + return 0;
> + }
>
> - if (fle != file_master(d))
> + if (!d->ops->post_open)
> return 0;
> -
> return d->ops->post_open(d, fle->fe->fd);
> }
>
> @@ -1034,11 +1035,6 @@ static int open_fd(int pid, struct fdinfo_list_entry *fle)
> static int receive_fd(int pid, struct fdinfo_list_entry *fle)
> {
> int fd;
> - struct fdinfo_list_entry *flem;
> -
> - flem = file_master(fle->desc);
> - if (flem->pid == pid)
> - return 0;
>
> pr_info("\tReceive fd for %d\n", fle->fe->fd);
>
>
> .
>
More information about the CRIU
mailing list