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
8d5822d9
Commit
8d5822d9
authored
Apr 23, 2014
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mnt: Factor out mntns nsid creation on restore
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
aca33ac4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
24 deletions
+24
-24
namespaces.h
include/namespaces.h
+1
-0
mount.c
mount.c
+4
-13
namespaces.c
namespaces.c
+19
-11
No files found.
include/namespaces.h
View file @
8d5822d9
...
@@ -50,6 +50,7 @@ extern int switch_ns(int pid, struct ns_desc *nd, int *rst);
...
@@ -50,6 +50,7 @@ extern int switch_ns(int pid, struct ns_desc *nd, int *rst);
extern
int
restore_ns
(
int
rst
,
struct
ns_desc
*
nd
);
extern
int
restore_ns
(
int
rst
,
struct
ns_desc
*
nd
);
extern
int
dump_task_ns_ids
(
struct
pstree_item
*
);
extern
int
dump_task_ns_ids
(
struct
pstree_item
*
);
extern
struct
ns_id
*
rst_new_ns_id
(
unsigned
int
id
,
pid_t
pid
,
struct
ns_desc
*
nd
);
extern
int
rst_add_ns_id
(
unsigned
int
id
,
pid_t
pid
,
struct
ns_desc
*
nd
);
extern
int
rst_add_ns_id
(
unsigned
int
id
,
pid_t
pid
,
struct
ns_desc
*
nd
);
extern
struct
ns_id
*
lookup_ns_by_id
(
unsigned
int
id
,
struct
ns_desc
*
nd
);
extern
struct
ns_id
*
lookup_ns_by_id
(
unsigned
int
id
,
struct
ns_desc
*
nd
);
...
...
mount.c
View file @
8d5822d9
...
@@ -1423,24 +1423,15 @@ static int rst_collect_local_mntns(void)
...
@@ -1423,24 +1423,15 @@ static int rst_collect_local_mntns(void)
{
{
struct
ns_id
*
nsid
;
struct
ns_id
*
nsid
;
nsid
=
shmalloc
(
sizeof
(
struct
ns_id
)
);
nsid
=
rst_new_ns_id
(
0
,
getpid
(),
&
mnt_ns_desc
);
if
(
nsid
==
NULL
)
if
(
!
nsid
)
return
-
1
;
return
-
1
;
nsid
->
nd
=
&
mnt_ns_desc
;
nsid
->
id
=
0
;
nsid
->
pid
=
getpid
();
futex_set
(
&
nsid
->
created
,
1
);
mntinfo
=
collect_mntinfo
(
nsid
);
mntinfo
=
collect_mntinfo
(
nsid
);
if
(
mntinfo
==
NULL
)
if
(
!
mntinfo
)
return
-
1
;
return
-
1
;
nsid
->
next
=
ns_ids
;
futex_set
(
&
nsid
->
created
,
1
);
ns_ids
=
nsid
;
pr_info
(
"Add namespace %d pid %d
\n
"
,
nsid
->
id
,
nsid
->
pid
);
return
0
;
return
0
;
}
}
...
...
namespaces.c
View file @
8d5822d9
...
@@ -117,6 +117,24 @@ struct ns_id *ns_ids = NULL;
...
@@ -117,6 +117,24 @@ struct ns_id *ns_ids = NULL;
static
unsigned
int
ns_next_id
=
1
;
static
unsigned
int
ns_next_id
=
1
;
unsigned
long
root_ns_mask
=
0
;
unsigned
long
root_ns_mask
=
0
;
struct
ns_id
*
rst_new_ns_id
(
unsigned
int
id
,
pid_t
pid
,
struct
ns_desc
*
nd
)
{
struct
ns_id
*
nsid
;
nsid
=
shmalloc
(
sizeof
(
*
nsid
));
if
(
nsid
)
{
nsid
->
nd
=
nd
;
nsid
->
id
=
id
;
nsid
->
pid
=
pid
;
futex_set
(
&
nsid
->
created
,
0
);
nsid
->
next
=
ns_ids
;
ns_ids
=
nsid
;
}
return
nsid
;
}
int
rst_add_ns_id
(
unsigned
int
id
,
pid_t
pid
,
struct
ns_desc
*
nd
)
int
rst_add_ns_id
(
unsigned
int
id
,
pid_t
pid
,
struct
ns_desc
*
nd
)
{
{
struct
ns_id
*
nsid
;
struct
ns_id
*
nsid
;
...
@@ -129,20 +147,10 @@ int rst_add_ns_id(unsigned int id, pid_t pid, struct ns_desc *nd)
...
@@ -129,20 +147,10 @@ int rst_add_ns_id(unsigned int id, pid_t pid, struct ns_desc *nd)
}
}
}
}
nsid
=
shmalloc
(
sizeof
(
struct
ns_id
));
if
(
rst_new_ns_id
(
id
,
pid
,
nd
)
==
NULL
)
if
(
nsid
==
NULL
)
return
-
1
;
return
-
1
;
nsid
->
nd
=
nd
;
nsid
->
id
=
id
;
nsid
->
pid
=
pid
;
futex_set
(
&
nsid
->
created
,
0
);
nsid
->
next
=
ns_ids
;
ns_ids
=
nsid
;
pr_info
(
"Add namespace %d pid %d
\n
"
,
nsid
->
id
,
nsid
->
pid
);
pr_info
(
"Add namespace %d pid %d
\n
"
,
nsid
->
id
,
nsid
->
pid
);
return
0
;
return
0
;
}
}
...
...
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