[CRIU] [PATCH 23/37] mount: __lookup_mnt_id returns the first mi if mnt_id == -1

Andrey Vagin avagin at openvz.org
Fri Apr 18 07:43:01 PDT 2014


Kernels before 3.15 doesn't show mnt_id in /proc/PID/fdinfo/X.
When processes are restored in a current mntns, we have only one root,
so here isn't matter which mount will be returned.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 mount.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/mount.c b/mount.c
index 62e185f..a759d79 100644
--- a/mount.c
+++ b/mount.c
@@ -110,9 +110,18 @@ static struct mount_info *__lookup_mnt_id(struct mount_info *list, int id)
 {
 	struct mount_info *m;
 
-	for (m = list; m != NULL; m = m->next)
+	for (m = list; m != NULL; m = m->next) {
+		/*
+		 * Kernel before 3.15 doesn't show mnt_id for file descriptors.
+		 * mnt_id isn't saved for files, if mntns isn't dumped.
+		 * In both these cases we have only one root, so here
+		 * is not matter which mount will be restured.
+		 */
+		if (id == -1)
+			return m;
 		if (m->mnt_id == id)
 			return m;
+	}
 
 	return NULL;
 }
-- 
1.8.5.3



More information about the CRIU mailing list