diff --git a/include/namespaces.h b/include/namespaces.h index 50ca9e8ce..d68a6100d 100644 --- a/include/namespaces.h +++ b/include/namespaces.h @@ -15,7 +15,15 @@ struct ns_id { pid_t pid; struct ns_desc *nd; 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 { struct { struct mount_info *mntinfo_list; diff --git a/mount.c b/mount.c index 086b6402e..fac1b35c7 100644 --- a/mount.c +++ b/mount.c @@ -1650,7 +1650,7 @@ static int rst_collect_local_mntns(void) if (!mntinfo) return -1; - futex_set(&nsid->created, 1); + futex_set(&nsid->ns_created, 1); return 0; } @@ -1820,7 +1820,7 @@ static int do_restore_task_mnt_ns(struct ns_id *nsid) if (nsid->pid != getpid()) { int fd; - futex_wait_while_eq(&nsid->created, 0); + futex_wait_while_eq(&nsid->ns_created, 0); fd = open_proc(nsid->pid, "ns/mnt"); if (fd < 0) return -1; @@ -1843,7 +1843,7 @@ static int do_restore_task_mnt_ns(struct ns_id *nsid) if (cr_pivot_root(path)) return -1; - futex_set_and_wake(&nsid->created, 1); + futex_set_and_wake(&nsid->ns_created, 1); return 0; } diff --git a/namespaces.c b/namespaces.c index 5e2f14312..cb5b41064 100644 --- a/namespaces.c +++ b/namespaces.c @@ -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->id = id; nsid->pid = pid; - futex_set(&nsid->created, 0); + futex_set(&nsid->ns_created, 0); nsid->next = ns_ids; ns_ids = nsid;