Commit 513dde00 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

sk-unix: connect unix sockets in post_open

Move logic from run_unix_connections to post_open().

I don't fix indents in this patch for easy reviewing.
They are fixed in the next patch.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent a74605a7
......@@ -495,8 +495,6 @@ int prepare_fds(struct pstree_item *me)
goto done;
}
}
ret = run_unix_connections();
done:
return ret;
}
......
......@@ -36,7 +36,6 @@ extern int collect_inet_sockets(void);
extern int collect_unix_sockets(void);
extern int fix_external_unix_sockets(void);
extern int resolve_unix_peers(void);
extern int run_unix_connections(void);
extern void show_unixsk(int fd, struct cr_options *o);
extern void show_inetsk(int fd, struct cr_options *o);
......
......@@ -504,19 +504,22 @@ static int schedule_conn_job(struct unix_sk_info *ui)
return 0;
}
int run_unix_connections(void)
static int post_open_unix_sk(struct file_desc *d, int fd)
{
struct unix_conn_job *cj;
pr_info("Running delayed unix connections\n");
cj = conn_jobs;
while (cj) {
struct unix_sk_info *ui = cj->sk;
struct unix_sk_info *peer = ui->peer;
struct unix_sk_info *ui;
struct unix_sk_info *peer;
struct fdinfo_list_entry *fle;
struct sockaddr_un addr;
ui = container_of(d, struct unix_sk_info, d);
if (ui->flags & (USK_PAIR_MASTER | USK_PAIR_SLAVE))
return 0;
peer = ui->peer;
if (peer == NULL)
return 0;
pr_info("\tConnect %#x to %#x\n", ui->ue->ino, peer->ue->ino);
fle = file_master(&ui->d);
......@@ -545,9 +548,6 @@ int run_unix_connections(void)
if (restore_socket_opts(fle->fe->fd, ui->ue->opts))
return -1;
cj = cj->next;
}
return 0;
}
......@@ -715,6 +715,7 @@ static int open_unix_sk(struct file_desc *d)
static struct file_desc_ops unix_desc_ops = {
.type = FD_TYPES__UNIXSK,
.open = open_unix_sk,
.post_open = post_open_unix_sk,
.want_transport = unixsk_should_open_transport,
};
......
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