aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2015-11-02 20:37:02 -0500
committerDave Chinner <david@fromorbit.com>2015-11-02 20:37:02 -0500
commit13ad4fe3e087ab66a140f1e00d98f28aa4e3bb28 (patch)
treee8f2cddd593803af2c6b8f6c31721ce7fe9d1fdb
parent3af49285854df66260a263198cc15abb07b95287 (diff)
xfs: xfs_filemap_pmd_fault treats read faults as write faults
The code initially committed didn't have the same checks for write faults as the dax_pmd_fault code and hence treats all faults as write faults. We can get read faults through this path because they is no pmd_mkwrite path for write faults similar to the normal page fault path. Hence we need to ensure that we only do c/mtime updates on write faults, and freeze protection is unnecessary for read faults. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r--fs/xfs/xfs_file.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index f429662d7d42..ce208e3896aa 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -1477,7 +1477,7 @@ xfs_file_llseek(
1477 * 1477 *
1478 * mmap_sem (MM) 1478 * mmap_sem (MM)
1479 * sb_start_pagefault(vfs, freeze) 1479 * sb_start_pagefault(vfs, freeze)
1480 * i_mmap_lock (XFS - truncate serialisation) 1480 * i_mmaplock (XFS - truncate serialisation)
1481 * page_lock (MM) 1481 * page_lock (MM)
1482 * i_lock (XFS - extent map serialisation) 1482 * i_lock (XFS - extent map serialisation)
1483 */ 1483 */
@@ -1545,6 +1545,13 @@ xfs_filemap_fault(
1545 return ret; 1545 return ret;
1546} 1546}
1547 1547
1548/*
1549 * Similar to xfs_filemap_fault(), the DAX fault path can call into here on
1550 * both read and write faults. Hence we need to handle both cases. There is no
1551 * ->pmd_mkwrite callout for huge pages, so we have a single function here to
1552 * handle both cases here. @flags carries the information on the type of fault
1553 * occuring.
1554 */
1548STATIC int 1555STATIC int
1549xfs_filemap_pmd_fault( 1556xfs_filemap_pmd_fault(
1550 struct vm_area_struct *vma, 1557 struct vm_area_struct *vma,
@@ -1561,13 +1568,18 @@ xfs_filemap_pmd_fault(
1561 1568
1562 trace_xfs_filemap_pmd_fault(ip); 1569 trace_xfs_filemap_pmd_fault(ip);
1563 1570
1564 sb_start_pagefault(inode->i_sb); 1571 if (flags & FAULT_FLAG_WRITE) {
1565 file_update_time(vma->vm_file); 1572 sb_start_pagefault(inode->i_sb);
1573 file_update_time(vma->vm_file);
1574 }
1575
1566 xfs_ilock(XFS_I(inode), XFS_MMAPLOCK_SHARED); 1576 xfs_ilock(XFS_I(inode), XFS_MMAPLOCK_SHARED);
1567 ret = __dax_pmd_fault(vma, addr, pmd, flags, xfs_get_blocks_dax_fault, 1577 ret = __dax_pmd_fault(vma, addr, pmd, flags, xfs_get_blocks_dax_fault,
1568 NULL); 1578 NULL);
1569 xfs_iunlock(XFS_I(inode), XFS_MMAPLOCK_SHARED); 1579 xfs_iunlock(XFS_I(inode), XFS_MMAPLOCK_SHARED);
1570 sb_end_pagefault(inode->i_sb); 1580
1581 if (flags & FAULT_FLAG_WRITE)
1582 sb_end_pagefault(inode->i_sb);
1571 1583
1572 return ret; 1584 return ret;
1573} 1585}