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

Submitted by Cyrill Gorcunov on Sept. 14, 2018, 2:08 p.m.

Details

Message ID 20180914140842.6462-9-gorcunov@gmail.com
State New
Series "unix: Add support for bindmounted dgram sockets"
Headers show

Commit Message

Cyrill Gorcunov Sept. 14, 2018, 2:08 p.m.
So when we will be examinating mount points and
sockets we won't waste time on non-bindmounted.

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

Patch hide | download patch | download mbox

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);
 }