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
7a16734e
Commit
7a16734e
authored
Aug 29, 2013
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rst: Formalize the shared resource restore order
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
cb648fb9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
6 deletions
+17
-6
files.c
files.c
+3
-4
crtools.h
include/crtools.h
+10
-0
files.h
include/files.h
+3
-1
shmem.c
shmem.c
+1
-1
No files found.
files.c
View file @
7a16734e
...
...
@@ -443,10 +443,9 @@ static int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info)
return
-
1
;
}
list_for_each_entry
(
le
,
&
fdesc
->
fd_info_head
,
desc_list
)
{
if
(
le
->
pid
>
new_le
->
pid
)
list_for_each_entry
(
le
,
&
fdesc
->
fd_info_head
,
desc_list
)
if
(
pid_rst_prio
(
new_le
->
pid
,
le
->
pid
)
)
break
;
}
list_add_tail
(
&
new_le
->
desc_list
,
&
le
->
desc_list
);
new_le
->
desc
=
fdesc
;
...
...
@@ -972,7 +971,7 @@ int shared_fdt_prepare(struct pstree_item *item)
item
->
rst
->
fdt
=
fdt
;
item
->
rst
->
service_fd_id
=
fdt
->
nr
;
fdt
->
nr
++
;
if
(
fdt
->
pid
>
item
->
pid
.
virt
)
if
(
pid_rst_prio
(
item
->
pid
.
virt
,
fdt
->
pid
)
)
fdt
->
pid
=
item
->
pid
.
virt
;
return
0
;
...
...
include/crtools.h
View file @
7a16734e
...
...
@@ -189,4 +189,14 @@ static inline int in_vma_area(struct vma_area *vma, unsigned long addr)
addr
<
(
unsigned
long
)
vma
->
vma
.
end
;
}
/*
* When we have to restore a shared resource, we mush select which
* task should do it, and make other(s) wait for it. In order to
* avoid deadlocks, always make task with lower pid be the restorer.
*/
static
inline
bool
pid_rst_prio
(
unsigned
pid_a
,
unsigned
pid_b
)
{
return
pid_a
<
pid_b
;
}
#endif
/* __CR_CRTOOLS_H__ */
include/files.h
View file @
7a16734e
...
...
@@ -6,6 +6,7 @@
#include "lock.h"
#include "list.h"
#include "image.h"
#include "crtools.h"
#include "protobuf/fdinfo.pb-c.h"
#include "protobuf/fown.pb-c.h"
...
...
@@ -69,7 +70,8 @@ struct fdinfo_list_entry {
/* reports whether fd_a takes prio over fd_b */
static
inline
int
fdinfo_rst_prio
(
struct
fdinfo_list_entry
*
fd_a
,
struct
fdinfo_list_entry
*
fd_b
)
{
return
(
fd_a
->
pid
<
fd_b
->
pid
)
||
((
fd_a
->
pid
==
fd_b
->
pid
)
&&
(
fd_a
->
fe
->
fd
<
fd_b
->
fe
->
fd
));
return
pid_rst_prio
(
fd_a
->
pid
,
fd_b
->
pid
)
||
((
fd_a
->
pid
==
fd_b
->
pid
)
&&
(
fd_a
->
fe
->
fd
<
fd_b
->
fe
->
fd
));
}
struct
file_desc_ops
{
...
...
shmem.c
View file @
7a16734e
...
...
@@ -44,7 +44,7 @@ static int collect_shmem(int pid, VmaEntry *vi)
* will wait until the kernel propagate this mapping
* into /proc
*/
if
(
si
->
pid
<=
pid
)
if
(
!
pid_rst_prio
(
pid
,
si
->
pid
)
)
return
0
;
si
->
pid
=
pid
;
...
...
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