[PATCH 1/4] mlockall(MCL_FUTURE) unlocks currently locked mappings

From: Chris Wright
Date: Wed Sep 29 2004 - 13:44:56 EST


Calling mlockall(MCL_FUTURE) will erroneously unlock any currently locked
mappings. Fix this up, and while we're at it, remove the essentially
unused error variable.

Signed-off-by: Chris Wright <chrisw@xxxxxxxx>

--- 2.6.9-rc2/mm/mlock.c~mcl_future 2004-09-28 15:00:11.781887352 -0700
+++ 2.6.9-rc2/mm/mlock.c 2004-09-28 15:27:01.784129808 -0700
@@ -138,7 +138,6 @@ asmlinkage long sys_munlock(unsigned lon

static int do_mlockall(int flags)
{
- int error;
unsigned int def_flags;
struct vm_area_struct * vma;

@@ -149,8 +148,9 @@ static int do_mlockall(int flags)
if (flags & MCL_FUTURE)
def_flags = VM_LOCKED;
current->mm->def_flags = def_flags;
+ if (flags == MCL_FUTURE)
+ goto out;

- error = 0;
for (vma = current->mm->mmap; vma ; vma = vma->vm_next) {
unsigned int newflags;

@@ -161,7 +161,8 @@ static int do_mlockall(int flags)
/* Ignore errors */
mlock_fixup(vma, vma->vm_start, vma->vm_end, newflags);
}
- return error;
+out:
+ return 0;
}

asmlinkage long sys_mlockall(int flags)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/