mm: rcu-protected get_mm_exe_file()
authorKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Thu, 16 Apr 2015 19:47:56 +0000 (12:47 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Apr 2015 13:04:07 +0000 (09:04 -0400)
This patch removes mm->mmap_sem from mm->exe_file read side.
Also it kills dup_mm_exe_file() and moves exe_file duplication into
dup_mmap() where both mmap_sems are locked.

[akpm@linux-foundation.org: fix comment typo]
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: Davidlohr Bueso <dbueso@suse.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/file.c
include/linux/fs.h
include/linux/mm_types.h
kernel/fork.c

index ee738ea..93c5f89 100644 (file)
--- a/fs/file.c
+++ b/fs/file.c
@@ -638,8 +638,7 @@ static struct file *__fget(unsigned int fd, fmode_t mask)
        file = fcheck_files(files, fd);
        if (file) {
                /* File object ref couldn't be taken */
-               if ((file->f_mode & mask) ||
-                   !atomic_long_inc_not_zero(&file->f_count))
+               if ((file->f_mode & mask) || !get_file_rcu(file))
                        file = NULL;
        }
        rcu_read_unlock();
Simple merge
Simple merge
diff --cc kernel/fork.c
Simple merge