Skip to content

Commit

Permalink
iomap: iomap_write_failed fix
Browse files Browse the repository at this point in the history
[ Upstream commit b71450e ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Andreas Gruenbacher authored and gregkh committed Jun 9, 2022
1 parent 4261a2e commit 3bfb520
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/iomap/buffered-io.c
Expand Up @@ -542,7 +542,8 @@ iomap_write_failed(struct inode *inode, loff_t pos, unsigned len)
* write started inside the existing inode size.
*/
if (pos + len > i_size)
truncate_pagecache_range(inode, max(pos, i_size), pos + len);
truncate_pagecache_range(inode, max(pos, i_size),
pos + len - 1);
}

static int iomap_read_folio_sync(loff_t block_start, struct folio *folio,
Expand Down

0 comments on commit 3bfb520

Please sign in to comment.