[CRIU] [PATCH 18/39] files: save mnt_id for reg files

Andrey Vagin avagin at openvz.org
Mon Apr 21 07:23:28 PDT 2014


Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 files-reg.c            | 11 +++++++++++
 protobuf/regfile.proto |  1 +
 2 files changed, 12 insertions(+)

diff --git a/files-reg.c b/files-reg.c
index 5b6c4a3..a425ce3 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -22,6 +22,7 @@
 #include "util.h"
 #include "fs-magic.h"
 #include "asm/atomic.h"
+#include "namespaces.h"
 
 #include "protobuf.h"
 #include "protobuf/regfile.pb-c.h"
@@ -557,6 +558,16 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p)
 	} else
 		link = p->link;
 
+	if (p->mnt_id >= 0 && (root_ns_mask & CLONE_NEWNS)) {
+		if (lookup_mnt_id(p->mnt_id) == NULL) {
+			pr_err("No mount for the %d file in the namespaces\n", p->mnt_id);
+			return -1;
+		}
+
+		rfe.mnt_id = p->mnt_id;
+		rfe.has_mnt_id = true;
+	}
+
 	pr_info("Dumping path for %d fd via self %d [%s]\n",
 			p->fd, lfd, &link->name[1]);
 
diff --git a/protobuf/regfile.proto b/protobuf/regfile.proto
index d975ab0..e91dc44 100644
--- a/protobuf/regfile.proto
+++ b/protobuf/regfile.proto
@@ -6,4 +6,5 @@ message reg_file_entry {
 	required uint64		pos	= 3;
 	required fown_entry	fown	= 5;
 	required string		name	= 6;
+	optional sint32		mnt_id	= 7 [default = -1];
 }
-- 
1.8.5.3



More information about the CRIU mailing list