Skip to content

Commit 43a511c

Browse files
author
Andreas Gruenbacher
committed
gfs2: Prevent direct-I/O write fallback errors from getting lost
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 <[email protected]>
1 parent d07f6ca commit 43a511c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/gfs2/file.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,11 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
911911
current->backing_dev_info = inode_to_bdi(inode);
912912
buffered = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops);
913913
current->backing_dev_info = NULL;
914-
if (unlikely(buffered <= 0))
914+
if (unlikely(buffered <= 0)) {
915+
if (!ret)
916+
ret = buffered;
915917
goto out_unlock;
918+
}
916919

917920
/*
918921
* We need to ensure that the page cache pages are written to

0 commit comments

Comments
 (0)