• Andreas Gruenbacher's avatar
    gfs2: Fix end-of-file handling in gfs2_page_mkwrite · 184b4e60
    Andreas Gruenbacher authored
    When the filesystem block size is smaller than the page size, the last
    page may contain blocks that lie entirely beyond the end of the file.
    Make sure to only allocate blocks that lie at least partially in the
    file.  Allocating blocks beyond that isn't useful, and what's more, they
    will not be zeroed out and may end up containing random data.
    
    With that change in place, make sure we'll still always unstuff stuffed
    inodes: iomap_writepage and iomap_writepages currently can't handle
    stuffed files.
    
    In addition, simplify and move the end-of-file check further to the top
    in gfs2_page_mkwrite to avoid weird side effects like unstuffing when
    we're not.
    
    Fixes xfstest generic/263.
    Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
    184b4e60
file.c 33.5 KB