• Martin Brandenburg's avatar
    orangefs: implement vm_ops->fault · a5135eea
    Martin Brandenburg authored
    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: default avatarMartin Brandenburg <martin@omnibond.com>
    Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
    a5135eea
file.c 18.1 KB