]> git.karo-electronics.de Git - linux-beck.git/commit
xfs: clear delalloc and cache on buffered write failure
authorBrian Foster <bfoster@redhat.com>
Fri, 17 Feb 2017 01:19:12 +0000 (17:19 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Feb 2017 10:10:52 +0000 (11:10 +0100)
commitd004006055974a976841c4f95e8c25ca7b5b38d5
tree65a0c657f16e114dc32288d54ca2293721fd1815
parent57d759622aa76591958f46707edebe20c284b7d2
xfs: clear delalloc and cache on buffered write failure

commit fa7f138ac4c70dc00519c124cf7cd4862a0a5b0e upstream.

The buffered write failure handling code in
xfs_file_iomap_end_delalloc() has a couple minor problems. First, if
written == 0, start_fsb is not rounded down and it fails to kill off a
delalloc block if the start offset is block unaligned. This results in a
lingering delalloc block and broken delalloc block accounting detected
at unmount time. Fix this by rounding down start_fsb in the unlikely
event that written == 0.

Second, it is possible for a failed overwrite of a delalloc extent to
leave dirty pagecache around over a hole in the file. This is because is
possible to hit ->iomap_end() on write failure before the iomap code has
attempted to allocate pagecache, and thus has no need to clean it up. If
the targeted delalloc extent was successfully written by a previous
write, however, then it does still have dirty pages when ->iomap_end()
punches out the underlying blocks. This ultimately results in writeback
over a hole. To fix this problem, unconditionally punch out the
pagecache from XFS before the associated delalloc range.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_iomap.c