Commit 9a64e003 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Andrei Vagin

forking: Introduce last_pid_mutex and helpers

Introduce mutex for synchronization ns_last_pid file
on restore.
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent dc1e3b59
......@@ -2328,6 +2328,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 {
......@@ -71,4 +72,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__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment