Skip to content

Commit 3758c48

Browse files
committed
cifs: Set zero_point in the copy_file_range() and remap_file_range()
Set zero_point in the copy_file_range() and remap_file_range() implementations so that we don't skip reading data modified on a server-side copy. Signed-off-by: David Howells <[email protected]> cc: Steve French <[email protected]> cc: Shyam Prasad N <[email protected]> cc: Rohith Surabattula <[email protected]> cc: Jeff Layton <[email protected]> cc: [email protected] cc: [email protected] cc: [email protected] cc: [email protected]
1 parent 1a5b4ed commit 3758c48

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/smb/client/cifsfs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,8 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
12871287
rc = cifs_flush_folio(target_inode, destend, &fstart, &fend, false);
12881288
if (rc)
12891289
goto unlock;
1290+
if (fend > target_cifsi->netfs.zero_point)
1291+
target_cifsi->netfs.zero_point = fend + 1;
12901292

12911293
/* Discard all the folios that overlap the destination region. */
12921294
cifs_dbg(FYI, "about to discard pages %llx-%llx\n", fstart, fend);
@@ -1305,6 +1307,8 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
13051307
fscache_resize_cookie(cifs_inode_cookie(target_inode),
13061308
new_size);
13071309
}
1310+
if (rc == 0 && new_size > target_cifsi->netfs.zero_point)
1311+
target_cifsi->netfs.zero_point = new_size;
13081312
}
13091313

13101314
/* force revalidate of size and timestamps of target file now
@@ -1396,6 +1400,8 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
13961400
rc = cifs_flush_folio(target_inode, destend, &fstart, &fend, false);
13971401
if (rc)
13981402
goto unlock;
1403+
if (fend > target_cifsi->netfs.zero_point)
1404+
target_cifsi->netfs.zero_point = fend + 1;
13991405

14001406
/* Discard all the folios that overlap the destination region. */
14011407
truncate_inode_pages_range(&target_inode->i_data, fstart, fend);

0 commit comments

Comments
 (0)