mm: allow drivers to prevent new writable mappings
authorDavid Herrmann <[email protected]>
Fri, 8 Aug 2014 21:25:25 +0000 (14:25 -0700)
committerLinus Torvalds <[email protected]>
Fri, 8 Aug 2014 22:57:31 +0000 (15:57 -0700)
commit4bb5f5d9395bc112d93a134d8f5b05611eddc9c0
tree68af5a8a8cc65375c51c25bff678d0f9825d86af
parent935e9f02e798051d2923d59f6025cd74f59aa0e1
mm: allow drivers to prevent new writable mappings

This patch (of 6):

The i_mmap_writable field counts existing writable mappings of an
address_space.  To allow drivers to prevent new writable mappings, make
this counter signed and prevent new writable mappings if it is negative.
This is modelled after i_writecount and DENYWRITE.

This will be required by the shmem-sealing infrastructure to prevent any
new writable mappings after the WRITE seal has been set.  In case there
exists a writable mapping, this operation will fail with EBUSY.

Note that we rely on the fact that iff you already own a writable mapping,
you can increase the counter without using the helpers.  This is the same
that we do for i_writecount.

Signed-off-by: David Herrmann <[email protected]>
Acked-by: Hugh Dickins <[email protected]>
Cc: Michael Kerrisk <[email protected]>
Cc: Ryan Lortie <[email protected]>
Cc: Lennart Poettering <[email protected]>
Cc: Daniel Mack <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/inode.c
include/linux/fs.h
kernel/fork.c
mm/mmap.c
mm/swap_state.c