• Benjamin Marzinski's avatar
    gfs2: writeout truncated pages · fd4c5748
    Benjamin Marzinski authored
    When gfs2 attempts to write a page to a file that is being truncated,
    and notices that the page is completely outside of the file size, it
    tries to invalidate it.  However, this may require a transaction for
    journaled data files to revoke any buffers from the page on the active
    items list. Unfortunately, this can happen inside a log flush, where a
    transaction cannot be started. Also, gfs2 may need to be able to remove
    the buffer from the ail1 list before it can finish the log flush.
    
    To deal with this, when writing a page of a file with data journalling
    enabled gfs2 now skips the check to see if the write is outside the file
    size, and simply writes it anyway. This situation can only occur when
    the truncate code still has the file locked exclusively, and hasn't
    marked this block as free in the metadata (which happens later in
    truc_dealloc).  After gfs2 writes this page out, the truncation code
    will shortly invalidate it and write out any revokes if necessary.
    
    To do this, gfs2 now implements its own version of block_write_full_page
    without the check, and calls the newly exported __block_write_full_page.
    It also no longer calls gfs2_writepage_common from gfs2_jdata_writepage.
    Signed-off-by: default avatarBenjamin Marzinski <bmarzins@redhat.com>
    Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
    fd4c5748
aops.c 32 KB