Skip to content

Commit b71450e

Browse files
Andreas GruenbacherDarrick J. Wong
authored andcommitted
iomap: iomap_write_failed fix
The @LenD parameter of truncate_pagecache_range() should be the offset of the last byte of the hole, not the first byte beyond it. Fixes: ae259a9 ("fs: introduce iomap infrastructure") Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
1 parent c5eb0a6 commit b71450e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/iomap/buffered-io.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,8 @@ iomap_write_failed(struct inode *inode, loff_t pos, unsigned len)
531531
* write started inside the existing inode size.
532532
*/
533533
if (pos + len > i_size)
534-
truncate_pagecache_range(inode, max(pos, i_size), pos + len);
534+
truncate_pagecache_range(inode, max(pos, i_size),
535+
pos + len - 1);
535536
}
536537

537538
static int iomap_read_folio_sync(loff_t block_start, struct folio *folio,

0 commit comments

Comments
 (0)