• O
    mm: mmap_region: kill correct_wcount/inode, use allow_write_access() · e8686772
    Oleg Nesterov 提交于
    correct_wcount and inode in mmap_region() just complicate the code.  This
    boolean was needed previously, when deny_write_access() was called before
    vma_merge(), now we can simply check VM_DENYWRITE and do
    allow_write_access() if it is set.
    
    allow_write_access() checks file != NULL, so this is safe even if it was
    possible to use VM_DENYWRITE && !file.  Just we need to ensure we use the
    same file which was deny_write_access()'ed, so the patch also moves "file
    = vma->vm_file" down after allow_write_access().
    Signed-off-by: NOleg Nesterov <oleg@redhat.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Colin Cross <ccross@android.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    e8686772
mmap.c 85.5 KB