aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 7407ab319875..7b93da72d4a2 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -319,17 +319,20 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
319 file = tmp->vm_file; 319 file = tmp->vm_file;
320 if (file) { 320 if (file) {
321 struct inode *inode = file->f_path.dentry->d_inode; 321 struct inode *inode = file->f_path.dentry->d_inode;
322 struct address_space *mapping = file->f_mapping;
323
322 get_file(file); 324 get_file(file);
323 if (tmp->vm_flags & VM_DENYWRITE) 325 if (tmp->vm_flags & VM_DENYWRITE)
324 atomic_dec(&inode->i_writecount); 326 atomic_dec(&inode->i_writecount);
325 327 spin_lock(&mapping->i_mmap_lock);
326 /* insert tmp into the share list, just after mpnt */ 328 if (tmp->vm_flags & VM_SHARED)
327 spin_lock(&file->f_mapping->i_mmap_lock); 329 mapping->i_mmap_writable++;
328 tmp->vm_truncate_count = mpnt->vm_truncate_count; 330 tmp->vm_truncate_count = mpnt->vm_truncate_count;
329 flush_dcache_mmap_lock(file->f_mapping); 331 flush_dcache_mmap_lock(mapping);
332 /* insert tmp into the share list, just after mpnt */
330 vma_prio_tree_add(tmp, mpnt); 333 vma_prio_tree_add(tmp, mpnt);
331 flush_dcache_mmap_unlock(file->f_mapping); 334 flush_dcache_mmap_unlock(mapping);
332 spin_unlock(&file->f_mapping->i_mmap_lock); 335 spin_unlock(&mapping->i_mmap_lock);
333 } 336 }
334 337
335 /* 338 /*
@@ -1406,6 +1409,7 @@ long do_fork(unsigned long clone_flags,
1406 init_completion(&vfork); 1409 init_completion(&vfork);
1407 } 1410 }
1408 1411
1412 audit_finish_fork(p);
1409 tracehook_report_clone(trace, regs, clone_flags, nr, p); 1413 tracehook_report_clone(trace, regs, clone_flags, nr, p);
1410 1414
1411 /* 1415 /*