Commit 7ca6cc1e authored by Pavel Emelyanov's avatar Pavel Emelyanov

mnt: Clean roots yard from criu process

So here it is. If root task dies on restore the roots yard
dir remains unrmdired :( Since we already know its name, we
can remove one from criu. By the time we get to this place
the sub mount namespace(s) are already dead and yard dir
is empty. But umounting should be done by tasks after
successfull restore, so keep depopulation there.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 3e7c92ed
......@@ -1546,9 +1546,6 @@ static int restore_task_with_children(void *_arg)
return 0;
err_fini_mnt:
if (current->parent == NULL)
depopulate_roots_yard();
err:
if (current->parent == NULL)
futex_abort_and_wake(&task_entries->nr_in_progress);
......@@ -1835,6 +1832,8 @@ static int restore_root_task(struct pstree_item *init)
*/
task_entries->nr_threads -= atomic_read(&task_entries->nr_zombies);
cleanup_mnt_ns();
ret = stop_usernsd();
if (ret < 0)
goto out_kill;
......@@ -1919,6 +1918,7 @@ out_kill:
out:
fini_cgroup();
cleanup_mnt_ns();
stop_usernsd();
__restore_switch_stage(CR_STATE_FAIL);
pr_err("Restoring FAILED.\n");
......
......@@ -118,5 +118,6 @@ extern int depopulate_roots_yard(void);
extern char *rst_get_mnt_root(int mnt_id);
extern int ext_mount_add(char *key, char *val);
extern int mntns_maybe_create_roots(void);
extern void cleanup_mnt_ns(void);
#endif /* __CR_MOUNT_H__ */
......@@ -2734,14 +2734,19 @@ int depopulate_roots_yard(void)
pr_perror("Can't unmount %s", mnt_roots);
ret = 1;
}
if (rmdir(mnt_roots)) {
pr_perror("Can't remove the directory %s", mnt_roots);
ret = 1;
}
return ret;
}
void cleanup_mnt_ns(void)
{
if (mnt_roots == NULL)
return;
if (rmdir(mnt_roots))
pr_perror("Can't remove the directory %s", mnt_roots);
}
int prepare_mnt_ns(void)
{
int ret = -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment