[CRIU] [PATCH 1/3] ns: Rename "created" futex and comment what it is
Pavel Emelyanov
xemul at parallels.com
Fri Nov 7 08:25:05 PST 2014
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
include/namespaces.h | 10 +++++++++-
mount.c | 6 +++---
namespaces.c | 2 +-
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/include/namespaces.h b/include/namespaces.h
index 50ca9e8..d68a610 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 086b640..fac1b35 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 5e2f143..cb5b410 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;
--
1.8.4.2
More information about the CRIU
mailing list