[CRIU] [PATCH v2 04/15] unix: Link all sockets in unix_sockets list
Kirill Tkhai
ktkhai at virtuozzo.com
Fri May 27 06:06:13 PDT 2016
List "unix_sockets" is used to link external sockets.
Change this, to link all unix sockets there. To differ
really external sockets in fix_external_unix_sockets(),
we may check for socket's already_dumped value.
This may be useful to traverse over all unix sockets
in a namespace.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/sk-unix.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index 3363cea..40cb9db 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -364,11 +364,7 @@ static int dump_one_unix_fd(int lfd, u32 id, const struct fd_parms *p)
* until all sockets the program owns are processed.
*/
if (!peer->sd.already_dumped) {
- if (list_empty(&peer->list)) {
- show_one_unix("Add a peer", peer);
- list_add_tail(&peer->list, &unix_sockets);
- }
-
+ show_one_unix("Add a peer", peer);
list_add(&sk->peer_node, &peer->peer_list);
sk->fd = dup(lfd);
if (sk->fd < 0) {
@@ -464,7 +460,6 @@ static int dump_one_unix_fd(int lfd, u32 id, const struct fd_parms *p)
if (list_empty(&sk->peer_node) && write_unix_entry(sk))
return -1;
- list_del_init(&sk->list);
sk->sd.already_dumped = 1;
while (!list_empty(&sk->peer_list)) {
@@ -677,6 +672,7 @@ static int unix_collect_one(const struct unix_diag_msg *m,
}
sk_collect_one(m->udiag_ino, AF_UNIX, &d->sd);
+ list_add_tail(&d->list, &unix_sockets);
show_one_unix("Collected", d);
return 0;
@@ -757,9 +753,10 @@ int fix_external_unix_sockets(void)
FownEntry fown = FOWN_ENTRY__INIT;
SkOptsEntry skopts = SK_OPTS_ENTRY__INIT;
- show_one_unix("Dumping extern", sk);
+ if (sk->sd.already_dumped)
+ continue;
- BUG_ON(sk->sd.already_dumped);
+ show_one_unix("Dumping extern", sk);
fd_id_generate_special(NULL, &e.id);
e.ino = sk->sd.ino;
More information about the CRIU
mailing list