• Andreas Gruenbacher's avatar
    gfs2: Improve mmap write vs. punch_hole consistency · 39c3a948
    Andreas Gruenbacher authored
    When punching a hole in a file, use filemap_write_and_wait_range to
    write back any dirty pages in the range of the hole.  As a side effect,
    if the hole isn't page aligned, this marks unaligned pages at the
    beginning and the end of the hole read-only.  This is required when the
    block size is smaller than the page size: when those pages are written
    to again after the hole punching, we must make sure that page_mkwrite is
    called for those pages so that the page will be fully allocated and any
    blocks turned into holes from the hole punching will be reallocated.
    (If a page is writably mapped, page_mkwrite won't be called.)
    
    Fixes xfstest generic/567.
    Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
    39c3a948
bmap.c 65 KB