From: Andreas Gruenbacher Date: Fri, 5 Nov 2021 23:18:56 +0000 (+0100) Subject: gfs2: Fix length of holes reported at end-of-file X-Git-Tag: v6.6.17~8788^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f3506eee81d1f700d9ee2d2f4a88fddb669ec032;p=platform%2Fkernel%2Flinux-rpi.git gfs2: Fix length of holes reported at end-of-file 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 --- diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 7235d53..d671084 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c @@ -940,7 +940,7 @@ do_alloc: else if (height == ip->i_height) ret = gfs2_hole_size(inode, lblock, len, mp, iomap); else - iomap->length = size - pos; + iomap->length = size - iomap->offset; } else if (flags & IOMAP_WRITE) { u64 alloc_size;