Commit f33908a8 authored by Pavel Emelyanov's avatar Pavel Emelyanov

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

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ee2e8e5b
...@@ -15,7 +15,15 @@ struct ns_id { ...@@ -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;
......
...@@ -1650,7 +1650,7 @@ static int rst_collect_local_mntns(void) ...@@ -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) ...@@ -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) ...@@ -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;
} }
......
...@@ -129,7 +129,7 @@ struct ns_id *rst_new_ns_id(unsigned int id, pid_t pid, struct ns_desc *nd) ...@@ -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;
......
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