VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / arch / s390 / mm / cmm.c
index 095a564..cb29503 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <asm/pgalloc.h>
 #include <asm/uaccess.h>
+#include <asm/smp.h>
 
 #include "../../../drivers/s390/net/smsgiucv.h"
 
@@ -255,13 +256,13 @@ static struct ctl_table cmm_table[];
 
 static int
 cmm_pages_handler(ctl_table *ctl, int write, struct file *filp,
-                 void *buffer, size_t *lenp)
+                 void *buffer, size_t *lenp, loff_t *ppos)
 {
        char buf[16], *p;
        long pages;
        int len;
 
-       if (!*lenp || (filp->f_pos && !write)) {
+       if (!*lenp || (*ppos && !write)) {
                *lenp = 0;
                return 0;
        }
@@ -290,19 +291,19 @@ cmm_pages_handler(ctl_table *ctl, int write, struct file *filp,
                        return -EFAULT;
        }
        *lenp = len;
-       filp->f_pos += len;
+       *ppos += len;
        return 0;
 }
 
 static int
 cmm_timeout_handler(ctl_table *ctl, int write, struct file *filp,
-                   void *buffer, size_t *lenp)
+                   void *buffer, size_t *lenp, loff_t *ppos)
 {
        char buf[64], *p;
        long pages, seconds;
        int len;
 
-       if (!*lenp || (filp->f_pos && !write)) {
+       if (!*lenp || (*ppos && !write)) {
                *lenp = 0;
                return 0;
        }
@@ -327,7 +328,7 @@ cmm_timeout_handler(ctl_table *ctl, int write, struct file *filp,
                        return -EFAULT;
        }
        *lenp = len;
-       filp->f_pos += len;
+       *ppos += len;
        return 0;
 }
 
@@ -407,6 +408,14 @@ struct ctl_table_header *cmm_sysctl_header;
 static int
 cmm_init (void)
 {
+       int rc;
+
+       /* Prevent logical cpu 0 from being set offline. */
+       rc = smp_get_cpu(cpumask_of_cpu(0));
+       if (rc) {
+               printk(KERN_ERR "CMM: unable to reserve cpu 0\n");
+               return rc;
+       }
 #ifdef CONFIG_CMM_PROC
        cmm_sysctl_header = register_sysctl_table(cmm_dir_table, 1);
 #endif
@@ -430,6 +439,8 @@ cmm_exit(void)
 #ifdef CONFIG_CMM_IUCV
        smsg_unregister_callback(SMSG_PREFIX, cmm_smsg_target);
 #endif
+       /* Allow logical cpu 0 to be set offline again. */
+       smp_put_cpu(0);
 }
 
 module_init(cmm_init);