Commit 4691dcf3 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

unix: Add support of ghost sockets

Unix sockets may be connected via deleted socket name,
moreover the name may be reused (ie same sun_addr but
different inodes).

To be able to handle them we do a few tricks:

 - when collecting sockets we figure out if "deleted"
   mark is present on the socket and if such we order
   this sockets creation and deletion with mutex, together
   with adding missing directories, and save this descriptors
   in fdstore if there are peers connected to

 - on restore we connect via procfs/fd/X as suggested by
   Andrew Vagin
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 787409df
...@@ -378,6 +378,10 @@ static int root_prepare_shared(void) ...@@ -378,6 +378,10 @@ static int root_prepare_shared(void)
if (ret) if (ret)
goto err; goto err;
ret = unix_prepare_root_shared();
if (ret)
goto err;
ret = add_fake_unix_queuers(); ret = add_fake_unix_queuers();
if (ret) if (ret)
goto err; goto err;
......
...@@ -58,6 +58,7 @@ extern int netlink_receive_one(struct nlmsghdr *hdr, struct ns_id *ns, void *arg ...@@ -58,6 +58,7 @@ extern int netlink_receive_one(struct nlmsghdr *hdr, struct ns_id *ns, void *arg
extern int unix_sk_id_add(unsigned int ino); extern int unix_sk_id_add(unsigned int ino);
extern int unix_sk_ids_parse(char *optarg); extern int unix_sk_ids_parse(char *optarg);
extern int unix_prepare_root_shared(void);
extern int do_dump_opt(int sk, int level, int name, void *val, int len); extern int do_dump_opt(int sk, int level, int name, void *val, int len);
#define dump_opt(s, l, n, f) do_dump_opt(s, l, n, f, sizeof(*f)) #define dump_opt(s, l, n, f) do_dump_opt(s, l, n, f, sizeof(*f))
......
This diff is collapsed.
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