summaryrefslogtreecommitdiff
path: root/fs/iomap
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2022-05-06 04:19:13 +0300
committerDarrick J. Wong <djwong@kernel.org>2022-05-09 00:47:42 +0300
commitb71450e2cc4b3c79f33c5bd276d152af9bd54f79 (patch)
treec199bc74f148a486d7f7694b33c712cd72d1c27a /fs/iomap
parentc5eb0a61238dd6faf37f58c9ce61c9980aaffd7a (diff)
downloadlinux-b71450e2cc4b3c79f33c5bd276d152af9bd54f79.tar.xz
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: ae259a9c8593 ("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>
Diffstat (limited to 'fs/iomap')
-rw-r--r--fs/iomap/buffered-io.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 8ce8720093b9..358ee1fb6f0d 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -531,7 +531,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,