[CRIU] [PATCH 4/7] files: Yield error in case if procfs namespace reference

Cyrill Gorcunov gorcunov at openvz.org
Wed May 8 09:00:38 EDT 2013


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 files.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/files.c b/files.c
index edaaa0e..5d3f089 100644
--- a/files.c
+++ b/files.c
@@ -32,6 +32,7 @@
 #include "eventpoll.h"
 #include "fsnotify.h"
 #include "signalfd.h"
+#include "namespaces.h"
 
 #include "parasite.h"
 #include "parasite-syscall.h"
@@ -263,6 +264,7 @@ static int dump_one_file(struct parasite_ctl *ctl, int fd, int lfd, struct fd_op
 	}
 
 	if (S_ISREG(p.stat.st_mode) || S_ISDIR(p.stat.st_mode)) {
+		struct ns_proc_entry found;
 		char path[PATH_MAX + 1];
 
 		p.nmlink = path;
@@ -273,6 +275,16 @@ static int dump_one_file(struct parasite_ctl *ctl, int fd, int lfd, struct fd_op
 			return -1;
 		}
 
+		/*
+		 * Regular file might be a reference to proc namespace
+		 * entry thus choose which strategy to dump it with.
+		 */
+		if (parse_ns_proc(&p.nmlink[1], p.nmsize - 1, &found) == 0) {
+			pr_err("Dumping procfs namespace reference "
+			       "is not yet implemented\n");
+			return -1;
+		}
+
 		return dump_reg_file(&p, lfd, fdinfo);
 	}
 
-- 
1.8.1.4



More information about the CRIU mailing list