Merge to Fedora kernel-2.6.7-1.441
[linux-2.6.git] / mm / mlock.c
index 1428063..9fa54d9 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/mman.h>
 #include <linux/mm.h>
+#include <linux/vs_memory.h>
 
 
 static int mlock_fixup(struct vm_area_struct * vma, 
@@ -60,7 +61,7 @@ static int do_mlock(unsigned long start, size_t len, int on)
        struct vm_area_struct * vma, * next;
        int error;
 
-       if (on && !can_do_mlock())
+       if (on && !capable(CAP_IPC_LOCK))
                return -EPERM;
        len = PAGE_ALIGN(len);
        end = start + len;
@@ -120,7 +121,7 @@ asmlinkage long sys_mlock(unsigned long start, size_t len)
        lock_limit >>= PAGE_SHIFT;
 
        /* check against resource limits */
-       if ( (locked <= lock_limit) || capable(CAP_IPC_LOCK))
+       if (locked <= lock_limit)
                error = do_mlock(start, len, 1);
 out:
        up_write(&current->mm->mmap_sem);
@@ -145,7 +146,7 @@ static int do_mlockall(int flags)
        unsigned int def_flags;
        struct vm_area_struct * vma;
 
-       if (!can_do_mlock())
+       if (!capable(CAP_IPC_LOCK))
                return -EPERM;
 
        def_flags = 0;