]> asedeno.scripts.mit.edu Git - linux.git/commit
gfs2: writeout truncated pages
authorBenjamin Marzinski <bmarzins@redhat.com>
Mon, 27 Jun 2016 15:01:06 +0000 (10:01 -0500)
committerBob Peterson <rpeterso@redhat.com>
Mon, 27 Jun 2016 15:03:12 +0000 (10:03 -0500)
commitfd4c5748b8d3f7420e8932ed0bde3d53cc8acc9d
tree52a1f020985cf68c53ee18431a5df0742ac4785d
parentb4bba38909c21689de21355e84259cb7b38f25ac
gfs2: writeout truncated pages

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: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
fs/gfs2/aops.c