summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2022-05-05 18:19:13 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-14 18:11:36 +0200
commit1253811c71e0070084416b39e8cc77bad799b3c5 (patch)
tree82c513d7b47501f7d69d9dc18b7b653f501e78e5
parent6b8291e574a8d722f95d0fd3d89dd5c916be9d65 (diff)
downloadlinux-stable-1253811c71e0070084416b39e8cc77bad799b3c5.tar.gz
linux-stable-1253811c71e0070084416b39e8cc77bad799b3c5.tar.bz2
linux-stable-1253811c71e0070084416b39e8cc77bad799b3c5.zip
iomap: iomap_write_failed fix
[ Upstream commit b71450e2cc4b3c79f33c5bd276d152af9bd54f79 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-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 5c73751adb2d..53cd7b2bb580 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -535,7 +535,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