[v3,06/17] regular files: create temporary spfs file if marked as unreachable

Submitted by Stanislav Kinsburskiy on May 19, 2016, 10:57 a.m.

Details

Message ID 20160519105744.15506.5973.stgit@skinsbursky-vz7-gold.qa.sw.ru
State Rejected
Series "NFS migration support"
Headers show

Commit Message

Stanislav Kinsburskiy May 19, 2016, 10:57 a.m.
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@virtuozzo.com>
---
 criu/files-reg.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Patch hide | download patch | download mbox

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);