Skip to content

Commit c49edec

Browse files
committed
NFS: Fix error reporting in nfs_file_write()
When doing O_DSYNC writes, the actual write errors are reported through generic_write_sync(), so we must test the result. Reported-by: J. R. Okajima <[email protected]> Fixes: 1829065 ("NFS: Move buffered I/O locking into nfs_file_write()") Signed-off-by: Trond Myklebust <[email protected]>
1 parent a41bd25 commit c49edec

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/nfs/file.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,10 @@ ssize_t nfs_file_write(struct kiocb *iocb, struct iov_iter *from)
657657
if (result <= 0)
658658
goto out;
659659

660-
written = generic_write_sync(iocb, result);
660+
result = generic_write_sync(iocb, result);
661+
if (result < 0)
662+
goto out;
663+
written = result;
661664
iocb->ki_pos += written;
662665

663666
/* Return error values */

0 commit comments

Comments
 (0)