[Devel] [PATCH 1/1] cr: fix compilation with CONFIG_UTS_NS=n

Serge E. Hallyn serue at us.ibm.com
Tue Jun 16 17:17:23 PDT 2009


It looks like Oren wanted ns c/r to "sort of work" with CONFIG_UTS_NS=n
but kernel/utsname.c is not compiled if CONFIG_UTS_NS=n.

Signed-off-by: Serge E. Hallyn <serue at us.ibm.com>
---
 include/linux/checkpoint.h |    5 +++++
 kernel/utsname.c           |   13 -------------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/include/linux/checkpoint.h b/include/linux/checkpoint.h
index c2f04c5..ef4fc33 100644
--- a/include/linux/checkpoint.h
+++ b/include/linux/checkpoint.h
@@ -136,8 +136,13 @@ extern int checkpoint_ns(struct ckpt_ctx *ctx, void *ptr);
 extern void *restore_ns(struct ckpt_ctx *ctx);
 
 /* uts-ns */
+#ifdef CONFIG_UTS_NS
 extern int checkpoint_uts_ns(struct ckpt_ctx *ctx, void *ptr);
 extern void *restore_uts_ns(struct ckpt_ctx *ctx);
+#else
+#define checkpoint_uts_ns checkpoint_bad
+#define restore_uts_ns restore_bad
+#endif
 
 /* ipc-ns */
 #ifdef CONFIG_SYSVIPC
diff --git a/kernel/utsname.c b/kernel/utsname.c
index 76f9966..5c12ebb 100644
--- a/kernel/utsname.c
+++ b/kernel/utsname.c
@@ -130,11 +130,6 @@ static struct uts_namespace *do_restore_uts_ns(struct ckpt_ctx *ctx)
 	    h->domainname_len > sizeof(uts_ns->name.domainname))
 		goto out;
 
-	/*
-	 * If !CONFIG_UTS_NS, do not restore the global uts state, as
-	 * it is used by other processes.
-	 */
-#ifdef CONFIG_UTS_NS
 	ret = -ENOMEM;
 	uts_ns = create_uts_ns();
 	if (!uts_ns)
@@ -153,14 +148,6 @@ static struct uts_namespace *do_restore_uts_ns(struct ckpt_ctx *ctx)
 	up_read(&uts_sem);
 	if (ret < 0)
 		goto out;
-#else
-	ret = -EEXIST;
-	/* complain if image contains multiple namespaces */
-	if (ctx->stats.uts_ns)
-		goto out;
-	uts_ns = current->nsproxy->uts_ns;
-	get_uts_ns(uts_ns);
-#endif
 
 	ctx->stats.uts_ns++;
  out:
-- 
1.6.1

_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list