1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Andreas Gruenbacher <agruenba@redhat.com>
3 Date: Thu, 17 Mar 2022 14:47:24 +0100
4 Subject: [PATCH] gfs2: Fix gfs2_file_buffered_write endless loop workaround
6 [ Upstream commit 46f3e0421ccb5474b5c006b0089b9dfd42534bb6 ]
8 Since commit 554c577cee95b, gfs2_file_buffered_write() can accidentally
9 return a truncated iov_iter, which might confuse callers. Fix that.
11 Fixes: 554c577cee95b ("gfs2: Prevent endless loops in gfs2_file_buffered_write")
12 Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
13 Signed-off-by: Sasha Levin <sashal@kernel.org>
14 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 1 file changed, 1 insertion(+)
19 diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
20 index 60390f9dc31f..e93185d804e0 100644
23 @@ -1086,6 +1086,7 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb,
24 gfs2_holder_uninit(gh);
27 + from->count = orig_count - read;
28 return read ? read : ret;