mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-04 08:15:37 +00:00
revert 246367e4e4
"add walk_all flag to walk_namespaces"
We no longer need to populate ext_ns->mnt.mntinfo_list until resolve_external_mounts(). We can rely on find_ext_ns_id() which does collect_mntinfo() on demand. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Tested-by: Tycho Andersen <tycho.andersen@canonical.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
42625eac0e
commit
745f845fa8
@@ -54,7 +54,7 @@ extern unsigned long root_ns_mask;
|
|||||||
extern const struct fdtype_ops nsfile_dump_ops;
|
extern const struct fdtype_ops nsfile_dump_ops;
|
||||||
extern struct collect_image_info nsfile_cinfo;
|
extern struct collect_image_info nsfile_cinfo;
|
||||||
|
|
||||||
extern int walk_namespaces(struct ns_desc *nd, bool walk_all, int (*cb)(struct ns_id *, void *), void *oarg);
|
extern int walk_namespaces(struct ns_desc *nd, int (*cb)(struct ns_id *, void *), void *oarg);
|
||||||
extern int collect_namespaces(bool for_dump);
|
extern int collect_namespaces(bool for_dump);
|
||||||
extern int collect_mnt_namespaces(bool for_dump);
|
extern int collect_mnt_namespaces(bool for_dump);
|
||||||
extern int dump_mnt_namespaces(void);
|
extern int dump_mnt_namespaces(void);
|
||||||
|
2
mount.c
2
mount.c
@@ -2687,7 +2687,7 @@ int collect_mnt_namespaces(bool for_dump)
|
|||||||
arg.for_dump = for_dump;
|
arg.for_dump = for_dump;
|
||||||
arg.need_to_validate = false;
|
arg.need_to_validate = false;
|
||||||
|
|
||||||
ret = walk_namespaces(&mnt_ns_desc, opts.autodetect_ext_mounts, collect_mntns, &arg);
|
ret = walk_namespaces(&mnt_ns_desc, collect_mntns, &arg);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
11
namespaces.c
11
namespaces.c
@@ -201,14 +201,9 @@ struct ns_id *lookup_ns_by_id(unsigned int id, struct ns_desc *nd)
|
|||||||
* tasks may live in it. Sometimes (CLONE_SUBNS) there can
|
* tasks may live in it. Sometimes (CLONE_SUBNS) there can
|
||||||
* be more than one namespace of that type. For this case
|
* be more than one namespace of that type. For this case
|
||||||
* we dump all namespace's info and recreate them on restore.
|
* we dump all namespace's info and recreate them on restore.
|
||||||
*
|
|
||||||
* In some cases (e.g. for external mount autodetection), we want to walk all
|
|
||||||
* the namespaces, regardless of who it is attached to. Passing walk_all=true
|
|
||||||
* forces the function to walk all the namespaces, regardless of who they
|
|
||||||
* belong to.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int walk_namespaces(struct ns_desc *nd, bool walk_all, int (*cb)(struct ns_id *, void *), void *oarg)
|
int walk_namespaces(struct ns_desc *nd, int (*cb)(struct ns_id *, void *), void *oarg)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct ns_id *ns;
|
struct ns_id *ns;
|
||||||
@@ -217,7 +212,7 @@ int walk_namespaces(struct ns_desc *nd, bool walk_all, int (*cb)(struct ns_id *,
|
|||||||
if (ns->nd != nd)
|
if (ns->nd != nd)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ns->pid == getpid() && !walk_all) {
|
if (ns->pid == getpid()) {
|
||||||
if (root_ns_mask & nd->cflag)
|
if (root_ns_mask & nd->cflag)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -602,7 +597,7 @@ int collect_user_namespaces(bool for_dump)
|
|||||||
if (!(root_ns_mask & CLONE_NEWUSER))
|
if (!(root_ns_mask & CLONE_NEWUSER))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return walk_namespaces(&net_ns_desc, false, collect_user_ns, NULL);
|
return walk_namespaces(&net_ns_desc, collect_user_ns, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_user_ns(int pid)
|
static int check_user_ns(int pid)
|
||||||
|
2
net.c
2
net.c
@@ -873,7 +873,7 @@ static int collect_net_ns(struct ns_id *ns, void *oarg)
|
|||||||
|
|
||||||
int collect_net_namespaces(bool for_dump)
|
int collect_net_namespaces(bool for_dump)
|
||||||
{
|
{
|
||||||
return walk_namespaces(&net_ns_desc, false, collect_net_ns,
|
return walk_namespaces(&net_ns_desc, collect_net_ns,
|
||||||
(void *)(for_dump ? 1UL : 0));
|
(void *)(for_dump ? 1UL : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user