[CRIU] [PATCH 1/3] files-reg: Revert: Make try_clean_ghost() use struct ghost_file ptr
Kirill Tkhai
ktkhai at virtuozzo.com
Mon Feb 8 05:03:04 PST 2016
ghost_files populates another process, than who does try_clean_ghost(),
so this list is not visible for the cleaner. Revert the patch.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
files-reg.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/files-reg.c b/files-reg.c
index 78cf76e..46bf9f9 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -494,18 +494,17 @@ int prepare_remaps(void)
return ret;
}
-static void try_clean_ghost(struct ghost_file *gf)
+static void try_clean_ghost(struct remap_info *ri)
{
char path[PATH_MAX];
int mnt_id, ret;
- mnt_id = gf->remap.rmnt_id;
+ mnt_id = ri->rfi->rfe->mnt_id; /* rirfirfe %) */
ret = rst_get_mnt_root(mnt_id, path, sizeof(path));
if (ret < 0)
return;
- snprintf(path + ret, PATH_MAX - ret, "/%s", gf->remap.rpath);
-
+ ghost_path(path + ret, sizeof(path) - 1, ri->rfi, ri->rfe);
if (!unlink(path)) {
pr_info(" `- X [%s] ghost\n", path);
return;
@@ -518,6 +517,7 @@ static void try_clean_ghost(struct ghost_file *gf)
*/
if ((errno == EISDIR)) {
+ strncpy(path + ret, ri->rfi->path, sizeof(path) - 1);
if (!rmdir(path)) {
pr_info(" `- Xd [%s] ghost\n", path);
return;
@@ -529,7 +529,7 @@ static void try_clean_ghost(struct ghost_file *gf)
void try_clean_remaps(int ns_fd)
{
- struct ghost_file *gf;
+ struct remap_info *ri;
int old_ns = -1;
int cwd_fd = -1;
@@ -559,8 +559,9 @@ void try_clean_remaps(int ns_fd)
}
}
- list_for_each_entry(gf, &ghost_files, list)
- try_clean_ghost(gf);
+ list_for_each_entry(ri, &remaps, list)
+ if (ri->rfe->remap_type == REMAP_TYPE__GHOST)
+ try_clean_ghost(ri);
if (old_ns >= 0) {
if (setns(old_ns, CLONE_NEWNS) < 0)
More information about the CRIU
mailing list