Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cascardo/linux.git] / ipc / ipc_sysctl.c
index e8075b2..8ad93c2 100644 (file)
@@ -62,29 +62,6 @@ static int proc_ipc_dointvec_minmax_orphans(struct ctl_table *table, int write,
        return err;
 }
 
-static int proc_ipc_callback_dointvec_minmax(struct ctl_table *table, int write,
-       void __user *buffer, size_t *lenp, loff_t *ppos)
-{
-       struct ctl_table ipc_table;
-       size_t lenp_bef = *lenp;
-       int rc;
-
-       memcpy(&ipc_table, table, sizeof(ipc_table));
-       ipc_table.data = get_ipc(table);
-
-       rc = proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos);
-
-       if (write && !rc && lenp_bef == *lenp)
-               /*
-                * Tunable has successfully been changed by hand. Disable its
-                * automatic adjustment. This simply requires unregistering
-                * the notifiers that trigger recalculation.
-                */
-               unregister_ipcns_notifier(current->nsproxy->ipc_ns);
-
-       return rc;
-}
-
 static int proc_ipc_doulongvec_minmax(struct ctl_table *table, int write,
        void __user *buffer, size_t *lenp, loff_t *ppos)
 {
@@ -96,54 +73,19 @@ static int proc_ipc_doulongvec_minmax(struct ctl_table *table, int write,
                                        lenp, ppos);
 }
 
-/*
- * Routine that is called when the file "auto_msgmni" has successfully been
- * written.
- * Two values are allowed:
- * 0: unregister msgmni's callback routine from the ipc namespace notifier
- *    chain. This means that msgmni won't be recomputed anymore upon memory
- *    add/remove or ipc namespace creation/removal.
- * 1: register back the callback routine.
- */
-static void ipc_auto_callback(int val)
-{
-       if (!val)
-               unregister_ipcns_notifier(current->nsproxy->ipc_ns);
-       else {
-               /*
-                * Re-enable automatic recomputing only if not already
-                * enabled.
-                */
-               recompute_msgmni(current->nsproxy->ipc_ns);
-               cond_register_ipcns_notifier(current->nsproxy->ipc_ns);
-       }
-}
-
-static int proc_ipcauto_dointvec_minmax(struct ctl_table *table, int write,
+static int proc_ipc_auto_msgmni(struct ctl_table *table, int write,
        void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        struct ctl_table ipc_table;
-       int oldval;
-       int rc;
+       int dummy = 0;
 
        memcpy(&ipc_table, table, sizeof(ipc_table));
-       ipc_table.data = get_ipc(table);
-       oldval = *((int *)(ipc_table.data));
+       ipc_table.data = &dummy;
 
-       rc = proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos);
+       if (write)
+               pr_info_once("writing to auto_msgmni has no effect");
 
-       if (write && !rc) {
-               int newval = *((int *)(ipc_table.data));
-               /*
-                * The file "auto_msgmni" has correctly been set.
-                * React by (un)registering the corresponding tunable, if the
-                * value has changed.
-                */
-               if (newval != oldval)
-                       ipc_auto_callback(newval);
-       }
-
-       return rc;
+       return proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos);
 }
 
 #else
@@ -151,8 +93,7 @@ static int proc_ipcauto_dointvec_minmax(struct ctl_table *table, int write,
 #define proc_ipc_dointvec         NULL
 #define proc_ipc_dointvec_minmax   NULL
 #define proc_ipc_dointvec_minmax_orphans   NULL
-#define proc_ipc_callback_dointvec_minmax  NULL
-#define proc_ipcauto_dointvec_minmax NULL
+#define proc_ipc_auto_msgmni      NULL
 #endif
 
 static int zero;
@@ -204,10 +145,19 @@ static struct ctl_table ipc_kern_table[] = {
                .data           = &init_ipc_ns.msg_ctlmni,
                .maxlen         = sizeof(init_ipc_ns.msg_ctlmni),
                .mode           = 0644,
-               .proc_handler   = proc_ipc_callback_dointvec_minmax,
+               .proc_handler   = proc_ipc_dointvec_minmax,
                .extra1         = &zero,
                .extra2         = &int_max,
        },
+       {
+               .procname       = "auto_msgmni",
+               .data           = NULL,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_ipc_auto_msgmni,
+               .extra1         = &zero,
+               .extra2         = &one,
+       },
        {
                .procname       =  "msgmnb",
                .data           = &init_ipc_ns.msg_ctlmnb,
@@ -224,15 +174,6 @@ static struct ctl_table ipc_kern_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_ipc_dointvec,
        },
-       {
-               .procname       = "auto_msgmni",
-               .data           = &init_ipc_ns.auto_msgmni,
-               .maxlen         = sizeof(int),
-               .mode           = 0644,
-               .proc_handler   = proc_ipcauto_dointvec_minmax,
-               .extra1         = &zero,
-               .extra2         = &one,
-       },
 #ifdef CONFIG_CHECKPOINT_RESTORE
        {
                .procname       = "sem_next_id",