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

files: Kill want_post_open_stage()

Since we are going to get rid of stage at all, kill this function
and call post_open_fd() unconditionally. It can handle the case,
when file_desc_ops::post_open is NULL

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 52164398
...@@ -857,16 +857,6 @@ err: ...@@ -857,16 +857,6 @@ err:
struct fd_open_state { struct fd_open_state {
char *name; char *name;
int (*cb)(int, struct fdinfo_list_entry *); int (*cb)(int, struct fdinfo_list_entry *);
/*
* Two last stages -- receive fds and post-open them -- are
* not required always. E.g. if no fd sharing takes place
* or task doens't have any files that need to be post-opened.
*
* Thus, in order not to scan through fdinfo-s lists in vain
* and speed things up a little bit, we may want to skeep these.
*/
bool required;
}; };
static int open_fd(int pid, struct fdinfo_list_entry *fle); static int open_fd(int pid, struct fdinfo_list_entry *fle);
...@@ -874,13 +864,11 @@ static int receive_fd(int pid, struct fdinfo_list_entry *fle); ...@@ -874,13 +864,11 @@ static int receive_fd(int pid, struct fdinfo_list_entry *fle);
static int post_open_fd(int pid, struct fdinfo_list_entry *fle); static int post_open_fd(int pid, struct fdinfo_list_entry *fle);
static struct fd_open_state states[] = { static struct fd_open_state states[] = {
{ "create", open_fd, true,}, { "create", open_fd, },
{ "receive", receive_fd, true,}, { "receive", receive_fd, },
{ "post_create", post_open_fd, false,}, { "post_create", post_open_fd, },
}; };
#define want_post_open_stage() do { states[2].required = true; } while (0)
static void transport_name_gen(struct sockaddr_un *addr, int *len, int pid) static void transport_name_gen(struct sockaddr_un *addr, int *len, int pid)
{ {
addr->sun_family = AF_UNIX; addr->sun_family = AF_UNIX;
...@@ -1025,9 +1013,6 @@ static int open_fd(int pid, struct fdinfo_list_entry *fle) ...@@ -1025,9 +1013,6 @@ static int open_fd(int pid, struct fdinfo_list_entry *fle)
struct file_desc *d = fle->desc; struct file_desc *d = fle->desc;
int new_fd; int new_fd;
if (d->ops->post_open)
want_post_open_stage();
if (fle != file_master(d)) if (fle != file_master(d))
return 0; return 0;
...@@ -1162,11 +1147,6 @@ int prepare_fds(struct pstree_item *me) ...@@ -1162,11 +1147,6 @@ int prepare_fds(struct pstree_item *me)
} }
for (state = 0; state < ARRAY_SIZE(states); state++) { for (state = 0; state < ARRAY_SIZE(states); state++) {
if (!states[state].required) {
pr_debug("Skipping %s fd stage\n", states[state].name);
continue;
}
ret = open_fdinfos(me->pid->ns[0].virt, &rsti(me)->fds, state); ret = open_fdinfos(me->pid->ns[0].virt, &rsti(me)->fds, state);
if (ret) if (ret)
break; break;
...@@ -1193,11 +1173,6 @@ int prepare_fds(struct pstree_item *me) ...@@ -1193,11 +1173,6 @@ int prepare_fds(struct pstree_item *me)
goto out_w; goto out_w;
for (state = 0; state < ARRAY_SIZE(states); state++) { for (state = 0; state < ARRAY_SIZE(states); state++) {
if (!states[state].required) {
pr_debug("Skipping %s fd stage\n", states[state].name);
continue;
}
/* /*
* Opening current TTYs require session to be already set up, * Opening current TTYs require session to be already set up,
* thus slave peers already handled now it's time for cttys, * thus slave peers already handled now it's time for cttys,
......
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