diff options
author | Zach Brown <zab@zabbo.net> | 2014-10-06 19:42:52 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-10-23 14:05:10 -0400 |
commit | e77a7b4f01b4c7b02c1c15b5d5b4ce4bd147b043 (patch) | |
tree | d246e8545d1b8fafb87a5a2d93640d39b3b5c2ff /fs | |
parent | 51904b08072a8bf2b9ed74d1bd7a5300a614471d (diff) |
nfsd: fix inclusive vfs_fsync_range() end
The vfs_fsync_range() call during write processing got the end of the
range off by one. The range is inclusive, not exclusive. The error has
nfsd sync more data than requested -- it's correct but unnecessary
overhead.
The call during commit processing is correct so I copied that pattern in
write processing. Maybe a helper would be nice but I kept it trivial.
This is untested. I found it while reviewing code for something else
entirely.
Signed-off-by: Zach Brown <zab@zabbo.net>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/vfs.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 989129e2d6ea..d16076bd9a7a 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -938,6 +938,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
938 | int stable = *stablep; | 938 | int stable = *stablep; |
939 | int use_wgather; | 939 | int use_wgather; |
940 | loff_t pos = offset; | 940 | loff_t pos = offset; |
941 | loff_t end = LLONG_MAX; | ||
941 | unsigned int pflags = current->flags; | 942 | unsigned int pflags = current->flags; |
942 | 943 | ||
943 | if (rqstp->rq_local) | 944 | if (rqstp->rq_local) |
@@ -969,10 +970,13 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
969 | fsnotify_modify(file); | 970 | fsnotify_modify(file); |
970 | 971 | ||
971 | if (stable) { | 972 | if (stable) { |
972 | if (use_wgather) | 973 | if (use_wgather) { |
973 | host_err = wait_for_concurrent_writes(file); | 974 | host_err = wait_for_concurrent_writes(file); |
974 | else | 975 | } else { |
975 | host_err = vfs_fsync_range(file, offset, offset+*cnt, 0); | 976 | if (*cnt) |
977 | end = offset + *cnt - 1; | ||
978 | host_err = vfs_fsync_range(file, offset, end, 0); | ||
979 | } | ||
976 | } | 980 | } |
977 | 981 | ||
978 | out_nfserr: | 982 | out_nfserr: |