Commit 8e0c1037 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

mount: Introduce @mntinfo_root variable

This variable should be carrying root of a parsed
mount tree pointed by @mntinfo. Thus if @mntinfo
get destroyed the @mntinfo_root should be set to NULL.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 921cf873
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "protobuf/mnt.pb-c.h" #include "protobuf/mnt.pb-c.h"
static struct mount_info *mntinfo; static struct mount_info *mntinfo;
static struct mount_info *mntinfo_tree;
int mntns_root = -1; int mntns_root = -1;
static DIR *open_mountpoint(struct mount_info *pm); static DIR *open_mountpoint(struct mount_info *pm);
...@@ -1071,6 +1072,7 @@ static int clean_mnt_ns(void) ...@@ -1071,6 +1072,7 @@ static int clean_mnt_ns(void)
return -1; return -1;
} }
mntinfo_tree = NULL;
pm = mnt_build_tree(mntinfo); pm = mnt_build_tree(mntinfo);
if (!pm) if (!pm)
return -1; return -1;
...@@ -1217,6 +1219,7 @@ static int populate_mnt_ns(int ns_pid) ...@@ -1217,6 +1219,7 @@ static int populate_mnt_ns(int ns_pid)
mnt_entry__free_unpacked(me, NULL); mnt_entry__free_unpacked(me, NULL);
close(img); close(img);
mntinfo_tree = NULL;
mntinfo = pms; mntinfo = pms;
pms = mnt_build_tree(pms); pms = mnt_build_tree(pms);
...@@ -1226,6 +1229,7 @@ static int populate_mnt_ns(int ns_pid) ...@@ -1226,6 +1229,7 @@ static int populate_mnt_ns(int ns_pid)
if (validate_mounts(pms)) if (validate_mounts(pms))
return -1; return -1;
mntinfo_tree = pms;
return mnt_tree_for_each(pms, do_mount_one); return mnt_tree_for_each(pms, do_mount_one);
err: err:
while (pms) { while (pms) {
......
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