[Devel] [PATCH] files-reg: forbid migration of opened device files on NFS
Stanislav Kinsburskiy
skinsbursky at virtuozzo.com
Tue Jun 27 14:32:29 MSK 2017
NFS is replaced by FUSE-based SPFS on restore. And SPFS is mounted via
libfuse, which uses "MS_NODEV" mount option.
Thus it's impossible to open a device file on SPFS.
This patch forbids dumping to prevent restore failure.
https://jira.sw.ru/browse/PSBM-55590
Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
criu/files-reg.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/criu/files-reg.c b/criu/files-reg.c
index 6e97a72..ee80b61 100644
--- a/criu/files-reg.c
+++ b/criu/files-reg.c
@@ -1350,6 +1350,25 @@ static bool should_check_size(int flags)
return true;
}
+static bool unsupported_nfs_file(const struct fd_link *link,
+ const struct fd_parms *parms)
+{
+ if (parms->fs_type != NFS_SUPER_MAGIC)
+ return false;
+
+ if (S_ISCHR(parms->stat.st_mode)) {
+ pr_err("Character devices ([%s]) migration on NFS are not supported\n", &link->name[1]);
+ return true;
+ }
+
+ if (S_ISBLK(parms->stat.st_mode)) {
+ pr_err("Block devices ([%s]) migration on NFS are not supported\n", &link->name[1]);
+ return true;
+ }
+
+ return false;
+}
+
int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p)
{
struct fd_link _link, *link;
@@ -1400,6 +1419,11 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p)
return -1;
}
+ if (unsupported_nfs_file(link, p)) {
+ pr_err("The path [%s] is not supported\n", &link->name[1]);
+ return -1;
+ }
+
if (check_path_remap(link, p, lfd, id, nsid))
return -1;
rfe.name = &link->name[1];
More information about the Devel
mailing list