Skip to content

Commit f3506ee

Browse files
author
Andreas Gruenbacher
committed
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 <[email protected]>
1 parent 49462e2 commit f3506ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/gfs2/bmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ static int __gfs2_iomap_get(struct inode *inode, loff_t pos, loff_t length,
940940
else if (height == ip->i_height)
941941
ret = gfs2_hole_size(inode, lblock, len, mp, iomap);
942942
else
943-
iomap->length = size - pos;
943+
iomap->length = size - iomap->offset;
944944
} else if (flags & IOMAP_WRITE) {
945945
u64 alloc_size;
946946

0 commit comments

Comments
 (0)