mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/4] mlockall(MCL_FUTURE) unlocks currently locked mappings
@ 2004-09-29 18:42 Chris Wright
  2004-09-29 18:45 ` [PATCH 2/4] mlockall() check rlimit only when MCL_CURRENT is set Chris Wright
  2004-09-30 23:47 ` [PATCH 1/4] mlockall(MCL_FUTURE) unlocks currently locked mappings Andrew Morton
  0 siblings, 2 replies; 7+ messages in thread
From: Chris Wright @ 2004-09-29 18:42 UTC (permalink / raw)
  To: akpm, torvalds; +Cc: linux-kernel

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@osdl.org>

--- 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)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-10-01  0:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-29 18:42 [PATCH 1/4] mlockall(MCL_FUTURE) unlocks currently locked mappings Chris Wright
2004-09-29 18:45 ` [PATCH 2/4] mlockall() check rlimit only when MCL_CURRENT is set Chris Wright
2004-09-29 18:47   ` [PATCH 3/4] make can_do_mlock useful for mlock/mlockall Chris Wright
2004-09-29 18:49     ` [PATCH 4/4] mlockall() take mmap_sem a bit later Chris Wright
2004-09-30 23:47 ` [PATCH 1/4] mlockall(MCL_FUTURE) unlocks currently locked mappings Andrew Morton
2004-10-01  0:22   ` Chris Wright
2004-10-01  0:58     ` Chris Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®