[CRIU] [PATCH 3/3 v2] proc-parse: Drop deleted postfix from the mountpoint root
Cyrill Gorcunov
gorcunov at gmail.com
Mon Aug 10 01:43:57 PDT 2015
On Mon, Aug 10, 2015 at 11:34:27AM +0300, Cyrill Gorcunov wrote:
> This address only a part of a problem with deleted mountpoint,
> so rather a fast fix to not block development, but warning
> issued to nag us to not forget resolve it before the release.
Update attached. This series is obviously untested yet.
-------------- next part --------------
>From 43db2070b4fb1117b8b0b103a46f3f4b3cdf3dfd Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Mon, 10 Aug 2015 11:31:47 +0300
Subject: [PATCH 3/3 v2] proc-parse: Drop deleted postfix from the mountpoint root
This address only a part of a problem with deleted mountpoint,
so rather a fast fix to not block development, but warning
issued to nag us to not forget resolve it before the release.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
files-reg.c | 2 +-
include/files-reg.h | 2 ++
proc_parse.c | 14 ++++++++++++++
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/files-reg.c b/files-reg.c
index ad40c2951216..5a664494f2d8 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -645,7 +645,7 @@ static inline bool nfs_silly_rename(char *rpath, const struct fd_parms *parms)
return (parms->fs_type == NFS_SUPER_MAGIC) && is_sillyrename_name(rpath);
}
-static int strip_deleted(struct fd_link *link)
+int strip_deleted(struct fd_link *link)
{
struct dcache_prepends {
const char *str;
diff --git a/include/files-reg.h b/include/files-reg.h
index 09cd90fe9b56..a9a8d4aae5a9 100644
--- a/include/files-reg.h
+++ b/include/files-reg.h
@@ -51,4 +51,6 @@ extern struct collect_image_info remap_cinfo;
extern void delete_link_remaps(void);
extern void free_link_remaps(void);
+extern int strip_deleted(struct fd_link *link);
+
#endif /* __CR_FILES_REG_H__ */
diff --git a/proc_parse.c b/proc_parse.c
index 00e2b7bc6d20..e856eef6ca58 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -29,6 +29,7 @@
#include "sysfs_parse.h"
#include "seccomp.h"
#include "namespaces.h"
+#include "files-reg.h"
#include "protobuf.h"
#include "protobuf/fdinfo.pb-c.h"
@@ -1009,6 +1010,7 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname)
unsigned int kmaj, kmin;
int ret, n;
char *sub, *opt = NULL;
+ struct fd_link root_link;
new->mountpoint = xmalloc(PATH_MAX);
if (new->mountpoint == NULL)
@@ -1025,6 +1027,18 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname)
cure_path(new->mountpoint);
cure_path(new->root);
+ /*
+ * FIXME: Revisit and make a proper restore
+ * of deleted roots. https://github.com/xemul/criu/issues/9
+ * for details.
+ */
+ root_link.len = strlen(new->root);
+ strcpy(root_link.name, new->root);
+ if (strip_deleted(&root_link)) {
+ pr_warn("Dropped postfix from the root");
+ strcpy(new->root, root_link.name);
+ }
+
new->mountpoint = xrealloc(new->mountpoint, strlen(new->mountpoint) + 1);
if (!new->mountpoint)
goto err;
--
2.4.3
More information about the CRIU
mailing list