gfs2: fix O_SYNC write handling
authorAndreas Gruenbacher <agruenba@redhat.com>
Tue, 14 Jan 2020 16:12:18 +0000 (17:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Feb 2020 12:34:07 +0000 (04:34 -0800)
commit4b67a516c63d946cbfd4e87853f5fcc17e2536f0
treedbe1037fae86b6f17728ad8b1f404d2e123c543b
parente57e77e9321c453f220fdd19a24669c2a58a53be
gfs2: fix O_SYNC write handling

commit 6e5e41e2dc4e4413296d5a4af54ac92d7cd52317 upstream.

In gfs2_file_write_iter, for direct writes, the error checking in the buffered
write fallback case is incomplete.  This can cause inode write errors to go
undetected.  Fix and clean up gfs2_file_write_iter along the way.

Based on a proposed fix by Christoph Hellwig <hch@lst.de>.

Fixes: 967bcc91b044 ("gfs2: iomap direct I/O support")
Cc: stable@vger.kernel.org # v4.19+
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/gfs2/file.c