]> git.itanic.dy.fi Git - linux-stable/commit
gfs2: Fix length of holes reported at end-of-file
authorAndreas Gruenbacher <agruenba@redhat.com>
Fri, 5 Nov 2021 23:18:56 +0000 (00:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Dec 2021 07:50:11 +0000 (08:50 +0100)
commiteb246efb6d17ae8b55e8d97966631690189cec38
treeced55f0b2b56e5c95528bea8ac778fc288e158b9
parent6dd5f1cc24147f08a8a185d4dc5add1d9ac81b9e
gfs2: Fix length of holes reported at end-of-file

[ Upstream commit f3506eee81d1f700d9ee2d2f4a88fddb669ec032 ]

Fix the length of holes reported at the end of a file: the length is
relative to the beginning of the extent, not the seek position which is
rounded down to the filesystem block size.

This bug went unnoticed for some time, but is now caught by the
following assertion in iomap_iter_done():

  WARN_ON_ONCE(iter->iomap.offset + iter->iomap.length <= iter->pos)

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/gfs2/bmap.c