mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-02 15:25:21 +00:00
mount: set nsid for each mount point
We want to look up mntns by mnt_id. Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
5418938ec3
commit
1b3fa9bc25
@@ -121,6 +121,7 @@ struct mount_info {
|
|||||||
int is_file;
|
int is_file;
|
||||||
bool is_ns_root;
|
bool is_ns_root;
|
||||||
struct mount_info *next;
|
struct mount_info *next;
|
||||||
|
struct ns_id *nsid;
|
||||||
|
|
||||||
/* tree linkage */
|
/* tree linkage */
|
||||||
struct mount_info *parent;
|
struct mount_info *parent;
|
||||||
@@ -144,7 +145,7 @@ extern void mnt_entry_free(struct mount_info *mi);
|
|||||||
|
|
||||||
struct vm_area_list;
|
struct vm_area_list;
|
||||||
|
|
||||||
extern struct mount_info *parse_mountinfo(pid_t pid);
|
extern struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid);
|
||||||
extern int parse_pid_stat(pid_t pid, struct proc_pid_stat *s);
|
extern int parse_pid_stat(pid_t pid, struct proc_pid_stat *s);
|
||||||
extern int parse_pid_stat_small(pid_t pid, struct proc_pid_stat_small *s);
|
extern int parse_pid_stat_small(pid_t pid, struct proc_pid_stat_small *s);
|
||||||
extern int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, bool use_map_files);
|
extern int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, bool use_map_files);
|
||||||
|
6
mount.c
6
mount.c
@@ -87,7 +87,7 @@ int collect_mount_info(pid_t pid)
|
|||||||
{
|
{
|
||||||
pr_info("Collecting mountinfo\n");
|
pr_info("Collecting mountinfo\n");
|
||||||
|
|
||||||
mntinfo = parse_mountinfo(pid);
|
mntinfo = parse_mountinfo(pid, NULL);
|
||||||
if (!mntinfo) {
|
if (!mntinfo) {
|
||||||
pr_err("Parsing mountinfo %d failed\n", getpid());
|
pr_err("Parsing mountinfo %d failed\n", getpid());
|
||||||
return -1;
|
return -1;
|
||||||
@@ -834,7 +834,7 @@ struct mount_info *collect_mntinfo(struct ns_id *ns)
|
|||||||
if (mntns_collect_root(ns->pid) < 0)
|
if (mntns_collect_root(ns->pid) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pm = parse_mountinfo(ns->pid);
|
pm = parse_mountinfo(ns->pid, ns);
|
||||||
if (!pm) {
|
if (!pm) {
|
||||||
pr_err("Can't parse %d's mountinfo\n", ns->pid);
|
pr_err("Can't parse %d's mountinfo\n", ns->pid);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -845,7 +845,6 @@ struct mount_info *collect_mntinfo(struct ns_id *ns)
|
|||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
return pm;
|
return pm;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
while (pm) {
|
while (pm) {
|
||||||
p = pm;
|
p = pm;
|
||||||
@@ -1481,6 +1480,7 @@ static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid)
|
|||||||
if (!pm)
|
if (!pm)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
pm->nsid = nsid;
|
||||||
pm->next = *pms;
|
pm->next = *pms;
|
||||||
*pms = pm;
|
*pms = pm;
|
||||||
|
|
||||||
|
@@ -906,7 +906,7 @@ err:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct mount_info *parse_mountinfo(pid_t pid)
|
struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid)
|
||||||
{
|
{
|
||||||
struct mount_info *list = NULL;
|
struct mount_info *list = NULL;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
@@ -927,6 +927,8 @@ struct mount_info *parse_mountinfo(pid_t pid)
|
|||||||
if (!new)
|
if (!new)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
new->nsid = nsid;
|
||||||
|
|
||||||
new->next = list;
|
new->next = list;
|
||||||
list = new;
|
list = new;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user