gfs2: Make sure not to return short direct writes
authorAndreas Gruenbacher <agruenba@redhat.com>
Thu, 24 Mar 2022 22:13:26 +0000 (23:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 May 2022 07:16:26 +0000 (09:16 +0200)
commit29a7b55a2111eed633d8fc16905a77c51a1f2f1d
treec94526732383de2ca6eba47bbd1c3588bffc4756
parenta55715f6ce7b693b5c67e3839ebcbdea7ba71138
gfs2: Make sure not to return short direct writes

[ Upstream commit 3bde4c48586074202044456285a97ccdf9048988 ]

When direct writes fail with -ENOTBLK because we're writing into a
hole (gfs2_iomap_begin()) or because of a page invalidation failure
(iomap_dio_rw()), we're falling back to buffered writes.  In that case,
when we lose the inode glock in gfs2_file_buffered_write(), we want to
re-acquire it instead of returning a short write.

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