diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2021-05-10 12:25:59 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-06-18 10:00:04 +0200 |
commit | c3e9ea16adc1ce378e7c1416dace0c93631e2fcc (patch) | |
tree | bea0d67407fcc858fc9657ce023ba4aa7d313143 /fs/gfs2/file.c | |
parent | 864b5a8d5390765ddb8e82b86b111de86868d65f (diff) | |
download | kernel_replicant_linux-c3e9ea16adc1ce378e7c1416dace0c93631e2fcc.tar.gz kernel_replicant_linux-c3e9ea16adc1ce378e7c1416dace0c93631e2fcc.tar.bz2 kernel_replicant_linux-c3e9ea16adc1ce378e7c1416dace0c93631e2fcc.zip |
gfs2: Prevent direct-I/O write fallback errors from getting lost
[ Upstream commit 43a511c44e58e357a687d61a20cf5ef1dc9e5a7c ]
When a direct I/O write falls entirely and falls back to buffered I/O and the
buffered I/O fails, the write failed with return value 0 instead of the error
number reported by the buffered I/O. Fix that.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/gfs2/file.c')
-rw-r--r-- | fs/gfs2/file.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index b39b339feddc..16fb0184ce5e 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -938,8 +938,11 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from) current->backing_dev_info = inode_to_bdi(inode); buffered = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops); current->backing_dev_info = NULL; - if (unlikely(buffered <= 0)) + if (unlikely(buffered <= 0)) { + if (!ret) + ret = buffered; goto out_unlock; + } /* * We need to ensure that the page cache pages are written to |