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 08:03:18 +0000 (09:03 +0100)
commit7b2b7e03e8eae9b8e83e6e936507ed33d5c954f1
treeb579353bdfd757a90d40614ba66f00a385e6994e
parent664cceab6f705d2405a546d0c0e24d30565c0b2a
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