From: Trond Myklebust <trondmy@gmail.com>
Date: Tue, 17 Dec 2019 12:33:33 -0500
Subject: [PATCH] nfsd: Return the correct number of bytes written to the file
Git-commit: 09a80f2aef06b7c86143f5c14efd3485e0d2c139
Patch-mainline: v5.6-rc1
References: git-fixes
We must allow for the fact that iov_iter_write() could have returned
a short write (e.g. if there was an ENOSPC issue).
Fixes: d890be159a71 "nfsd: Add I/O trace points in the NFSv4 write path"
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Acked-by: NeilBrown <neilb@suse.com>
---
fs/nfsd/vfs.c | 1 +
1 file changed, 1 insertion(+)
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1029,6 +1029,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, s
host_err = vfs_iter_write(file, &iter, &pos, flags);
if (host_err < 0)
goto out_nfserr;
+ *cnt = host_err;
nfsdstats.io_write += *cnt;
fsnotify_modify(file);