Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
87d68fca
Commit
87d68fca
authored
Oct 09, 2014
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mnt: Use ns walking helper
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
a36917d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
37 deletions
+21
-37
mount.c
mount.c
+21
-37
No files found.
mount.c
View file @
87d68fca
...
@@ -2078,52 +2078,36 @@ int mntns_get_root_by_mnt_id(int mnt_id)
...
@@ -2078,52 +2078,36 @@ int mntns_get_root_by_mnt_id(int mnt_id)
return
mntns_get_root_fd
(
mntns
);
return
mntns_get_root_fd
(
mntns
);
}
}
int
collect_mnt_namespaces
(
void
)
static
int
collect_mntns
(
struct
ns_id
*
ns
,
void
*
oarg
)
{
{
struct
mount_info
*
pms
;
struct
mount_info
*
pms
;
struct
ns_id
*
ns
;
int
ret
=
-
1
;
for
(
ns
=
ns_ids
;
ns
;
ns
=
ns
->
next
)
{
pms
=
collect_mntinfo
(
ns
);
if
(
!
(
ns
->
nd
->
cflag
&
CLONE_NEWNS
)
)
if
(
!
pms
)
continue
;
return
-
1
;
if
(
ns
->
pid
==
getpid
())
{
if
(
ns
->
pid
!=
getpid
())
/*
*
(
int
*
)
oarg
=
1
;
* Collect criu's mounts only if the target
* task does NOT live in mount namespaces to
* make smart paths resolution work.
*
* Otherwise, the necessary list of mounts
* will be collected below.
*/
if
((
root_ns_mask
&
CLONE_NEWNS
))
continue
;
mntinfo
=
collect_mntinfo
(
ns
);
mntinfo_add_list
(
pms
);
if
(
mntinfo
==
NULL
)
return
0
;
goto
err
;
}
/*
* Mount namespaces are dumped only if the root task lives in
* its own mntns, so we can stop enumeration of namespaces.
* We are not going to dump this tree, so we skip validation.
*/
goto
out
;
}
pr_info
(
"Dump MNT namespace (mountpoints) %d via %d
\n
"
,
ns
->
id
,
ns
->
pid
);
int
collect_mnt_namespaces
(
void
)
pms
=
collect_mntinfo
(
ns
);
{
if
(
pms
==
NULL
)
int
need_to_validate
=
0
,
ret
;
goto
err
;
ret
=
walk_namespaces
(
&
mnt_ns_desc
,
collect_mntns
,
&
need_to_validate
);
if
(
ret
)
goto
err
;
mntinfo_add_list
(
pms
);
if
(
need_to_validate
)
{
if
(
collect_shared
(
mntinfo
))
goto
err
;
if
(
validate_mounts
(
mntinfo
,
true
))
goto
err
;
}
}
if
(
collect_shared
(
mntinfo
))
goto
err
;
if
(
validate_mounts
(
mntinfo
,
true
))
goto
err
;
out:
ret
=
0
;
ret
=
0
;
err:
err:
return
ret
;
return
ret
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment