[CRIU] [PATCH 08/19] unix: Collect bindmounted unix sockets into own list

Cyrill Gorcunov gorcunov at gmail.com
Fri Sep 14 17:08:31 MSK 2018


So when we will be examinating mount points and
sockets we won't waste time on non-bindmounted.

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 criu/sk-unix.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index 87f652689331..ef31c43626f1 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -98,6 +98,7 @@ static mutex_t *mutex_ghost;
 
 static LIST_HEAD(unix_sockets);
 static LIST_HEAD(unix_ghost_addr);
+static LIST_HEAD(unix_mnt_sockets);
 
 static int unix_resolve_name(int lfd, uint32_t id, struct unix_sk_desc *d,
 			     UnixSkEntry *ue, const struct fd_parms *p);
@@ -994,6 +995,7 @@ int collect_unix_bindmounts(void)
 struct unix_sk_info {
 	UnixSkEntry		*ue;
 	struct list_head	list;
+	struct list_head	mnt_list;
 	char			*name;
 	char			*name_dir;
 	unsigned		flags;
@@ -2142,6 +2144,7 @@ static int init_unix_sk_info(struct unix_sk_info *ui, UnixSkEntry *ue)
 	memzero(&ui->d, sizeof(ui->d));
 
 	INIT_LIST_HEAD(&ui->list);
+	INIT_LIST_HEAD(&ui->mnt_list);
 	INIT_LIST_HEAD(&ui->connected);
 	INIT_LIST_HEAD(&ui->node);
 	INIT_LIST_HEAD(&ui->scm_fles);
@@ -2234,6 +2237,9 @@ static int collect_one_unixsk(void *o, ProtobufCMessage *base, struct cr_img *i)
 		list_add_tail(&ui->ghost_node, &unix_ghost_addr);
 	}
 
+	if (ui->ue->uflags & UNIX_UFLAGS__BINDMOUNT)
+		list_add_tail(&ui->mnt_list, &unix_mnt_sockets);
+
 	list_add_tail(&ui->list, &unix_sockets);
 	return file_desc_add(&ui->d, ui->ue->id, &unix_desc_ops);
 }
-- 
2.17.1



More information about the CRIU mailing list