Commit 93e996d8 authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

mount: umount a temporary mount with MTN_DETACH

If a temporary mount is a shared one, a new mount can be
propagated into it.

Fixes: 0e9736ab ("mount: fix restoring a bind-mount when its root is overmounted)")

Reported-by: Mr Jenkins
Signed-off-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 78a52116
...@@ -2383,7 +2383,15 @@ out: ...@@ -2383,7 +2383,15 @@ out:
exit_code = 0; exit_code = 0;
err: err:
if (umount_mnt_path) { if (umount_mnt_path) {
if (umount(mnt_path)) { /*
* If mnt_path was shared, a new mount may be propagated
* into it.
*/
if (mount(NULL, mnt_path, NULL, MS_PRIVATE, NULL)) {
pr_perror("Unable to make %s private", mnt_path);
return -1;
}
if (umount2(mnt_path, MNT_DETACH)) {
pr_perror("Unable to umount %s", mnt_path); pr_perror("Unable to umount %s", mnt_path);
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