]> git.baikalelectronics.ru Git - kernel.git/commit
gfs2: Prevent endless loops in gfs2_file_buffered_write
authorAndreas Gruenbacher <agruenba@redhat.com>
Tue, 9 Nov 2021 12:57:17 +0000 (13:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 May 2022 07:14:38 +0000 (09:14 +0200)
commit65c6e3cb47ace9eb047f017bc7653247a609c2fd
tree4ff38fb8ada5b5469124b2658fb5eaba234d837f
parent37933de84aa8a2b188925cf9f29ba2df2b94b2d5
gfs2: Prevent endless loops in gfs2_file_buffered_write

[ Upstream commit 4ea610b00656e357cd3d588850cb0bd958d897d3 ]

Currently, instead of performing a short write,
iomap_file_buffered_write will fail when part of its iov iterator cannot
be read.  In contrast, gfs2_file_buffered_write will loop around if it
can read part of the iov iterator, so we can end up in an endless loop.

This should be fixed in iomap_file_buffered_write (and also
generic_perform_write), but this comes a bit late in the 5.16
development cycle, so work around it in the filesystem by
trimming the iov iterator to the known-good size for now.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/gfs2/file.c