[CRIU] [PATCH 3/9] unux: postpone dumping sockets

Andrey Vagin avagin at openvz.org
Thu Dec 19 09:34:59 PST 2013


Unix sockets are dumped, when a peer socket is found.
We are going to dump external sockets with help plugins. For the we need
to set the USK_CALLBACK flags in unix entry. Currently a socket is
dumped immediately when it's transfered, but we can be sure that a
socket is not external, only when we have its peer.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 sk-unix.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sk-unix.c b/sk-unix.c
index 9fe3ef3..7cc1093 100644
--- a/sk-unix.c
+++ b/sk-unix.c
@@ -324,7 +324,7 @@ dump:
 	pr_info("Dumping unix socket at %d\n", p->fd);
 	show_one_unix("Dumping", sk);
 
-	if (write_unix_entry(sk))
+	if (list_empty(&sk->peer_node) && write_unix_entry(sk))
 		goto err;
 
 	list_del_init(&sk->list);
@@ -335,6 +335,9 @@ dump:
 		psk = list_first_entry(&sk->peer_list, struct unix_sk_desc, peer_node);
 		close_safe(&psk->fd);
 		list_del_init(&psk->peer_node);
+
+		if (write_unix_entry(psk))
+			goto err;
 	}
 
 	return 0;
@@ -559,6 +562,9 @@ int fix_external_unix_sockets(void)
 			psk = list_first_entry(&sk->peer_list, struct unix_sk_desc, peer_node);
 			close_safe(&psk->fd);
 			list_del_init(&psk->peer_node);
+
+			if (write_unix_entry(psk))
+				goto err;
 		}
 	}
 
-- 
1.8.3.1



More information about the CRIU mailing list