Commit 84bf1ad4 authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

mount: don't do MS_REC|MS_PRIVATE for host mounts

Here is a race when someone umounted something and this operation
isn't propagated into our namespace.

CRIU					| Another process
-----------------------------------------------------------------
pivot_root(".", put_root)		|
mount(put_root, MS_REC|MS_PRIVATE)	|
					| umount /xxx/yyy
					| umount /xxx -> EBUSY
umount(put_root)

We do this to not affect mounts in put_root, but we can mask
these mounts as slave and this will work for us and for external
users.
Signed-off-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent bdc972fd
...@@ -2726,7 +2726,7 @@ static int cr_pivot_root(char *root) ...@@ -2726,7 +2726,7 @@ static int cr_pivot_root(char *root)
goto err_tmpfs; goto err_tmpfs;
} }
if (mount("none", put_root, "none", MS_REC|MS_PRIVATE, NULL)) { if (mount("none", put_root, "none", MS_REC|MS_SLAVE, NULL)) {
pr_perror("Can't remount root with MS_PRIVATE"); pr_perror("Can't remount root with MS_PRIVATE");
return -1; return -1;
} }
......
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