Skip to content
Commit af55c059 authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov
Browse files

mount: fix a race between restoring namespaces and file mappings (v2)



Currently we wait when a namespace will be restored to get its root.
We need to open a namespace root to open a file to restore a memory mapping.

A process restores mappings and only then forks children. So we can have
a situation, when we need to open a file from a namespace, which will be
"restored" by one of our children.

The root task restores all mount namespaces and opens a file descriptor
for each of them. In this patch we open root for each mntns in the root
task.

If we neeed to get root of a namespace which isn't populated, we can get
it from the root task. After the CR_STATE_FORKING stage, the root task
closes all namespace descriptors ane we know that all namespaces are
populated at this moment.

v2: don't close root_fd for root ns, because it was not opened
Signed-off-by: default avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: default avatarPavel Emelyanov <xemul@parallels.com>
parent a9be7621
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment