mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-28 21:07:43 +00:00
forking: Introduce last_pid_mutex and helpers
Introduce mutex for synchronization ns_last_pid file on restore. Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
a90aad23a4
commit
e032b85c51
@ -2403,6 +2403,7 @@ int prepare_task_entries(void)
|
||||
task_entries->nr_helpers = 0;
|
||||
futex_set(&task_entries->start, CR_STATE_FAIL);
|
||||
mutex_init(&task_entries->userns_sync_lock);
|
||||
mutex_init(&task_entries->last_pid_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ struct task_entries {
|
||||
futex_t start;
|
||||
atomic_t cr_err;
|
||||
mutex_t userns_sync_lock;
|
||||
mutex_t last_pid_mutex;
|
||||
};
|
||||
|
||||
struct fdt {
|
||||
@ -66,4 +67,16 @@ struct rst_info {
|
||||
void *breakpoint;
|
||||
};
|
||||
|
||||
extern struct task_entries *task_entries;
|
||||
|
||||
static inline void lock_last_pid(void)
|
||||
{
|
||||
mutex_lock(&task_entries->last_pid_mutex);
|
||||
}
|
||||
|
||||
static inline void unlock_last_pid(void)
|
||||
{
|
||||
mutex_unlock(&task_entries->last_pid_mutex);
|
||||
}
|
||||
|
||||
#endif /* __CR_RST_INFO_H__ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user