Skip to contentSkip to conversation

ipc namespace: initialize init_ipc_ns.count to 1

PATCH New Serge E. Hallyn 1 participant 1 message Mar 4, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipc namespace: initialize init_ipc_ns.count to 1

Hi Andrew,

when I sent an earlier version of the posix mqueue namespaces patchset you called me on setting init_ipc_ns.count to 2. The following patch changes that to 1. This is safe because the 1-count is for swapper, who cannot unshare the namespace. Having init do unshare(CLONE_NEWIPC) only drops the count to 1. No pre-init resources other than tasks pin (and therefore can decrease the refcount on) an ipc_ns.

---
 ipc/msgutil.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
ipc/msgutil.c +1 -2
index e5d6da1..f095ee2 100644
@@ -26,8 +26,7 @@ DEFINE_SPINLOCK(mq_lock);
  * and not CONFIG_IPC_NS.
  */
 struct ipc_namespace init_ipc_ns = {
-	/* It's not for this patch to change, but should this be 1? */
-	.count		= ATOMIC_INIT(2),
+	.count		= ATOMIC_INIT(1),
 #ifdef CONFIG_POSIX_MQUEUE
 	.mq_queues_max   = DFLT_QUEUESMAX,
 	.mq_msg_max      = DFLT_MSGMAX,
Signature · 1 line
1.5.4.3