]> Git Repo - linux.git/commit - fs/orangefs/file.c
orangefs: implement vm_ops->fault
authorMartin Brandenburg <[email protected]>
Tue, 3 Apr 2018 16:27:12 +0000 (16:27 +0000)
committerMike Marshall <[email protected]>
Wed, 4 Apr 2018 01:55:27 +0000 (21:55 -0400)
commita5135eeab2e5ca1b94f34dcb772cb30f9f390efc
treeb0dfd6a088635db87a807a8dbecdce12e93aaca8
parentdbcb5e7fc470c9daec9cb4ae463670f2047163e3
orangefs: implement vm_ops->fault

Must retrieve size before running filemap_fault so the kernel has
an up-to-date size.

This should have been caught by xfstests generic/246, but it was masked
by orangefs_new_inode, which set i_size to PAGE_SIZE.  When nothing
caused a getattr prior to a pagefault, i_size was still PAGE_SIZE.
Since xfstests only read 10 bytes, it did not catch this bug.

When orangefs_new_inode was modified to perform a getattr instead,
i_size was set to zero, as it was a newly created file.  Then
orangefs_file_write_iter did NOT set i_size.  Instead it invalidated the
attribute cache, which should have caused the next caller to retrieve
i_size.  But the fault handler did not know it was supposed to retrieve
i_size.  So during xfstests, i_size was still zero, and filemap_fault
returned VM_FAULT_SIGBUS.

Fixes xfstests generic/452.

Signed-off-by: Martin Brandenburg <[email protected]>
Signed-off-by: Mike Marshall <[email protected]>
fs/orangefs/file.c
This page took 0.040606 seconds and 4 git commands to generate.