Commit 11811248 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Pavel Emelyanov

files: Kill fd_open_state::receive_fd stage

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.

In other words, only masters have post_open stage,
and only slaves have receive stage. So, in the case of
A and B files:

A->open
B->open
A->recv
A->post_open
B->recv
B->post_open

A->post_open can't depend on B->recv. This follows
just from analyzing of all file types post_open methods.

travis-ci: success for Rework file opening scheme to make it asynchronous (rev5)
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent ceb6b19c
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment