gfs2: Ignore journal log writes for jdata holes
authorBob Peterson <rpeterso@redhat.com>
Thu, 27 Aug 2020 17:18:37 +0000 (12:18 -0500)
committerAndreas Gruenbacher <agruenba@redhat.com>
Thu, 15 Oct 2020 12:29:04 +0000 (14:29 +0200)
commitb2a846dbef4ef54ef032f0f5ee188c609a0278a7
tree7cd4ca92a66e7fb6b4a5a7caac9589fe95bdba28
parenta6645745d45da5b3dd3ff616a3e44f7651eda9f9
gfs2: Ignore journal log writes for jdata holes

When flushing out its ail1 list, gfs2_write_jdata_page calls function
__block_write_full_page passing in function gfs2_get_block_noalloc.
But there was a problem when a process wrote to a jdata file, then
truncated it or punched a hole, leaving references to the blocks within
the new hole in its ail list, which are to be written to the journal log.

In writing them to the journal, after calling gfs2_block_map, function
gfs2_get_block_noalloc determined that the (hole-punched) block was not
mapped, so it returned -EIO to generic_writepages, which passed it back
to gfs2_ail1_start_one. This, in turn, performed a withdraw, assuming
there was a real IO error writing to the journal.

This might be a valid error when writing metadata to the journal, but for
journaled data writes, it does not warrant a withdraw.

This patch adds a check to function gfs2_block_map that makes an exception
for journaled data writes that correspond to jdata holes: If the iomap
get function returns a block type of IOMAP_HOLE, it instead returns
-ENODATA which does not cause the withdraw. Other errors are returned as
before.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/bmap.c