Commit 1b3fa9bc authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

mount: set nsid for each mount point

We want to look up mntns by mnt_id.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 5418938e
......@@ -121,6 +121,7 @@ struct mount_info {
int is_file;
bool is_ns_root;
struct mount_info *next;
struct ns_id *nsid;
/* tree linkage */
struct mount_info *parent;
......@@ -144,7 +145,7 @@ extern void mnt_entry_free(struct mount_info *mi);
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_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);
......
......@@ -87,7 +87,7 @@ int collect_mount_info(pid_t pid)
{
pr_info("Collecting mountinfo\n");
mntinfo = parse_mountinfo(pid);
mntinfo = parse_mountinfo(pid, NULL);
if (!mntinfo) {
pr_err("Parsing mountinfo %d failed\n", getpid());
return -1;
......@@ -834,7 +834,7 @@ struct mount_info *collect_mntinfo(struct ns_id *ns)
if (mntns_collect_root(ns->pid) < 0)
return NULL;
pm = parse_mountinfo(ns->pid);
pm = parse_mountinfo(ns->pid, ns);
if (!pm) {
pr_err("Can't parse %d's mountinfo\n", ns->pid);
return NULL;
......@@ -845,7 +845,6 @@ struct mount_info *collect_mntinfo(struct ns_id *ns)
goto err;
return pm;
err:
while (pm) {
p = pm;
......@@ -1481,6 +1480,7 @@ static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid)
if (!pm)
goto err;
pm->nsid = nsid;
pm->next = *pms;
*pms = pm;
......
......@@ -906,7 +906,7 @@ err:
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;
FILE *f;
......@@ -927,6 +927,8 @@ struct mount_info *parse_mountinfo(pid_t pid)
if (!new)
goto err;
new->nsid = nsid;
new->next = list;
list = new;
......
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