2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00

ns: Rename "created" futex and comment what it is

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2014-11-07 20:25:05 +04:00
parent ee2e8e5bb9
commit f33908a897
3 changed files with 13 additions and 5 deletions

View File

@@ -15,7 +15,15 @@ struct ns_id {
pid_t pid; pid_t pid;
struct ns_desc *nd; struct ns_desc *nd;
struct ns_id *next; struct ns_id *next;
futex_t created; /* boolean */
/*
* For mount namespaces on restore -- indicates that
* the namespace in question is created (all mounts
* are mounted) and other tasks may do setns on it
* and proceed.
*/
futex_t ns_created;
union { union {
struct { struct {
struct mount_info *mntinfo_list; struct mount_info *mntinfo_list;

View File

@@ -1650,7 +1650,7 @@ static int rst_collect_local_mntns(void)
if (!mntinfo) if (!mntinfo)
return -1; return -1;
futex_set(&nsid->created, 1); futex_set(&nsid->ns_created, 1);
return 0; return 0;
} }
@@ -1820,7 +1820,7 @@ static int do_restore_task_mnt_ns(struct ns_id *nsid)
if (nsid->pid != getpid()) { if (nsid->pid != getpid()) {
int fd; int fd;
futex_wait_while_eq(&nsid->created, 0); futex_wait_while_eq(&nsid->ns_created, 0);
fd = open_proc(nsid->pid, "ns/mnt"); fd = open_proc(nsid->pid, "ns/mnt");
if (fd < 0) if (fd < 0)
return -1; return -1;
@@ -1843,7 +1843,7 @@ static int do_restore_task_mnt_ns(struct ns_id *nsid)
if (cr_pivot_root(path)) if (cr_pivot_root(path))
return -1; return -1;
futex_set_and_wake(&nsid->created, 1); futex_set_and_wake(&nsid->ns_created, 1);
return 0; return 0;
} }

View File

@@ -129,7 +129,7 @@ struct ns_id *rst_new_ns_id(unsigned int id, pid_t pid, struct ns_desc *nd)
nsid->nd = nd; nsid->nd = nd;
nsid->id = id; nsid->id = id;
nsid->pid = pid; nsid->pid = pid;
futex_set(&nsid->created, 0); futex_set(&nsid->ns_created, 0);
nsid->next = ns_ids; nsid->next = ns_ids;
ns_ids = nsid; ns_ids = nsid;