[CRIU] [PATCH 2/5] change find_ext_ns_id() to do collect_mntinfo(ext_ns) on demand

Oleg Nesterov oleg at redhat.com
Tue Apr 14 09:54:06 PDT 2015


Currently we rely on the fact that ->mntinfo_list was already
collected by walk_namespaces(walk_all => true), but we are going
to change this.

This patch simply adds collect_mntinfo(ns) into find_ext_ns_id() if
->mntinfo_list == NULL. This is all we need for this ns_id if it was
not initialized by collect_mnt_namespaces().

Signed-off-by: Oleg Nesterov <oleg at redhat.com>
---
 mount.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/mount.c b/mount.c
index 9891c53..62696a9 100644
--- a/mount.c
+++ b/mount.c
@@ -699,6 +699,9 @@ static struct ns_id *find_ext_ns_id(void)
 
 	for (ns = ns_ids; ns->next; ns = ns->next)
 		if (ns->pid == pid && ns->nd == &mnt_ns_desc) {
+			if (!ns->mnt.mntinfo_list &&
+			    !collect_mntinfo(ns, true))
+				break;
 			return ns;
 		}
 
-- 
1.5.5.1



More information about the CRIU mailing list