Skip to content

Commit 79a1d88

Browse files
Brian FosterChuck Lever
authored andcommitted
NFSD: pass range end to vfs_fsync_range() instead of count
_nfsd_copy_file_range() calls vfs_fsync_range() with an offset and count (bytes written), but the former wants the start and end bytes of the range to sync. Fix it up. Fixes: eac0b17 ("NFSD add vfs_fsync after async copy is done") Signed-off-by: Brian Foster <[email protected]> Tested-by: Dai Ngo <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 9f27783 commit 79a1d88

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/nfsd/nfs4proc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,6 +1642,7 @@ static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy,
16421642
u64 src_pos = copy->cp_src_pos;
16431643
u64 dst_pos = copy->cp_dst_pos;
16441644
int status;
1645+
loff_t end;
16451646

16461647
/* See RFC 7862 p.67: */
16471648
if (bytes_total == 0)
@@ -1661,8 +1662,8 @@ static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy,
16611662
/* for a non-zero asynchronous copy do a commit of data */
16621663
if (nfsd4_copy_is_async(copy) && copy->cp_res.wr_bytes_written > 0) {
16631664
since = READ_ONCE(dst->f_wb_err);
1664-
status = vfs_fsync_range(dst, copy->cp_dst_pos,
1665-
copy->cp_res.wr_bytes_written, 0);
1665+
end = copy->cp_dst_pos + copy->cp_res.wr_bytes_written - 1;
1666+
status = vfs_fsync_range(dst, copy->cp_dst_pos, end, 0);
16661667
if (!status)
16671668
status = filemap_check_wb_err(dst->f_mapping, since);
16681669
if (!status)

0 commit comments

Comments
 (0)