mm: mmap_region: kill correct_wcount/inode, use allow_write_access() 03/32903/1
authorOleg Nesterov <oleg@redhat.com>
Wed, 11 Sep 2013 21:20:20 +0000 (14:20 -0700)
committerMaciej Wereski <m.wereski@partner.samsung.com>
Mon, 29 Dec 2014 08:31:34 +0000 (09:31 +0100)
commit5988dd09c4983bed7c2671446de5715a63036bb3
treed4ef3c53f6dabe86ff1b3d2898f6c02322040b42
parentd71cd852d88a36a25b0e8ad05a5f72f540bdd085
mm: mmap_region: kill correct_wcount/inode, use allow_write_access()

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: Oleg 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Change-Id: I05df8842b7c4b7e3e29b35d914f297ce37af1685
Origin: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e86867720e617774b560dfbc169b7f3d0d490950
Backported-by: Maciej Wereski <m.wereski@partner.samsung.com>
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
mm/mmap.c