ipc: recompute msgmni on ipc namespace creation/removal
[safe/jmp/linux-2.6] / ipc / namespace.c
index f7a35be..9171d94 100644 (file)
@@ -26,6 +26,12 @@ static struct ipc_namespace *clone_ipc_ns(struct ipc_namespace *old_ns)
        msg_init_ns(ns);
        shm_init_ns(ns);
 
+       /*
+        * msgmni has already been computed for the new ipc ns.
+        * Thus, do the ipcns creation notification before registering that
+        * new ipcns in the chain.
+        */
+       ipcns_notify(IPCNS_CREATED);
        register_ipcns_notifier(ns);
 
        kref_init(&ns->kref);
@@ -97,4 +103,10 @@ void free_ipc_ns(struct kref *kref)
        shm_exit_ns(ns);
        kfree(ns);
        atomic_dec(&nr_ipc_ns);
+
+       /*
+        * Do the ipcns removal notification after decrementing nr_ipc_ns in
+        * order to have a correct value when recomputing msgmni.
+        */
+       ipcns_notify(IPCNS_REMOVED);
 }