patch-2.1.106 linux/kernel/fork.c

Next file: linux/kernel/kmod.c
Previous file: linux/ipc/shm.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.105/linux/kernel/fork.c linux/kernel/fork.c
@@ -204,7 +204,6 @@
 	int retval;
 
 	flush_cache_mm(current->mm);
-	down(&current->mm->mmap_sem);
 	pprev = &mm->mmap;
 	for (mpnt = current->mm->mmap ; mpnt ; mpnt = mpnt->vm_next) {
 		struct file *file;
@@ -254,7 +253,6 @@
 
 fail_nomem:
 	flush_tlb_mm(current->mm);
-	up(&current->mm->mmap_sem);
 	return retval;
 }
 
@@ -466,6 +464,7 @@
 	int error = -ENOMEM;
 	struct task_struct *p;
 
+	down(&current->mm->mmap_sem);
 	lock_kernel();
 	p = alloc_task_struct();
 	if (!p)
@@ -570,6 +569,7 @@
 	++total_forks;
 	error = p->pid;
 bad_fork:
+	up(&current->mm->mmap_sem);
 	unlock_kernel();
 	return error;
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov