Dave Chinner 653c60b633 xfs: introduce mmap/truncate lock
Right now we cannot serialise mmap against truncate or hole punch
sanely. ->page_mkwrite is not able to take locks that the read IO
path normally takes (i.e. the inode iolock) because that could
result in lock inversions (read - iolock - page fault - page_mkwrite
- iolock) and so we cannot use an IO path lock to serialise page
write faults against truncate operations.

Instead, introduce a new lock that is used *only* in the
->page_mkwrite path that is the equivalent of the iolock. The lock
ordering in a page fault is i_mmaplock -> page lock -> i_ilock,
and so in truncate we can i_iolock -> i_mmaplock and so lock out
new write faults during the process of truncation.

Because i_mmap_lock is outside the page lock, we can hold it across
all the same operations we hold the i_iolock for. The only
difference is that we never hold the i_mmaplock in the normal IO
path and so do not ever have the possibility that we can page fault
inside it. Hence there are no recursion issues on the i_mmap_lock
and so we can use it to serialise page fault IO against inode
modification operations that affect the IO path.

This patch introduces the i_mmaplock infrastructure, lockdep
annotations and initialisation/destruction code. Use of the new lock
will be in subsequent patches.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-02-23 21:43:37 +11:00
..
2014-07-30 09:12:05 +10:00
2015-02-16 11:49:23 +11:00
2013-05-07 18:45:36 -05:00
2011-08-12 16:21:35 -05:00
2012-11-19 20:11:24 -06:00
2013-08-12 16:53:39 -05:00
2011-08-12 16:21:35 -05:00
2014-06-25 14:58:08 +10:00
2011-08-12 16:21:35 -05:00
2015-02-23 21:43:37 +11:00
2015-02-23 21:43:37 +11:00
2013-08-12 16:56:06 -05:00
2013-05-07 18:45:36 -05:00
2015-02-10 16:15:17 -08:00
2015-02-10 16:15:17 -08:00
2015-02-23 21:43:37 +11:00
2014-07-30 09:12:05 +10:00
2015-01-09 10:47:43 +11:00
2014-09-09 11:52:42 +10:00
2013-05-07 18:45:36 -05:00