[CRIU] [PATCH v2 06/17] regular files: create temporary spfs file if marked as unreachable

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Thu May 19 02:23:26 PDT 2016


IN case of unreachable file systems like NFS, there is no file to open on
restore.
Thus, it has to be created.
Luckely, criu doesn't write anything to it.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 criu/files-reg.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/criu/files-reg.c b/criu/files-reg.c
index e3da972..03e0d35 100644
--- a/criu/files-reg.c
+++ b/criu/files-reg.c
@@ -28,6 +28,7 @@
 #include "namespaces.h"
 #include "proc_parse.h"
 #include "pstree.h"
+#include "spfs.h"
 
 #include "protobuf.h"
 #include "images/regfile.pb-c.h"
@@ -1471,6 +1472,13 @@ int open_path(struct file_desc *d,
 
 	mntns_root = mntns_get_root_by_mnt_id(rfi->rfe->mnt_id);
 ext:
+	if (rfi->rfe->unreachable) {
+		if (spfs_create_file(mntns_root, rfi) < 0) {
+			pr_err("Failed to create SPFS path\n");
+			return -1;
+		}
+	}
+
 	tmp = open_cb(mntns_root, rfi, arg);
 	if (tmp < 0) {
 		pr_perror("Can't open file %s", rfi->path);



More information about the CRIU mailing list