Commit 92e739e9 authored by Pavel Emelyanov's avatar Pavel Emelyanov

mount: Reset mountinfos when mntns recreated

The list of mounts is used by inotify to restore a watch with open-by-handle. The problem
is that after the clean_mnt_ns is done the mntinfo list is no longer relevant.

Fix it by freeing the old one and initializing the new with the read-from-image stuff.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent d8a6ecc6
......@@ -389,6 +389,7 @@ static int do_umount_one(struct mount_info *mi)
static int clean_mnt_ns(void)
{
int ret;
struct mount_info *pm;
pr_info("Cleaning mount namespace\n");
......@@ -401,7 +402,15 @@ static int clean_mnt_ns(void)
if (!pm)
return -1;
return mnt_tree_for_each_reverse(pm, do_umount_one);
ret = mnt_tree_for_each_reverse(pm, do_umount_one);
while (mntinfo) {
pm = mntinfo->next;
xfree(mntinfo);
mntinfo = pm;
}
return ret;
}
static int populate_mnt_ns(int ns_pid)
......@@ -469,6 +478,7 @@ static int populate_mnt_ns(int ns_pid)
mnt_entry__free_unpacked(me, NULL);
close(img);
mntinfo = pms;
pms = mnt_build_tree(pms);
if (!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