nfsd: Return the correct number of bytes written to the file

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: d890be159a "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>
This commit is contained in:
Trond Myklebust 2019-12-17 12:33:33 -05:00 committed by J. Bruce Fields
parent d781e3df71
commit 09a80f2aef
1 changed files with 1 additions and 0 deletions

View File

@ -975,6 +975,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
host_err = vfs_iter_write(file, &iter, &pos, flags); host_err = vfs_iter_write(file, &iter, &pos, flags);
if (host_err < 0) if (host_err < 0)
goto out_nfserr; goto out_nfserr;
*cnt = host_err;
nfsdstats.io_write += *cnt; nfsdstats.io_write += *cnt;
fsnotify_modify(file); fsnotify_modify(file);