path: root/include
diff options
authorJeff Layton <>2021-06-13 19:33:45 -0400
committerDavid Howells <>2021-06-21 21:24:07 +0100
commit827a746f405d25f79560c7868474aec5aee174e1 (patch)
tree020798c6aa0d9eee41ce18b91e8f2b4f93ae0c7f /include
parent66e9c6a86b800f60b1e1ea1ff7271f9e6ed1fa96 (diff)
netfs: fix test for whether we can skip read when writing beyond EOF
It's not sufficient to skip reading when the pos is beyond the EOF. There may be data at the head of the page that we need to fill in before the write. Add a new helper function that corrects and clarifies the logic of when we can skip reads, and have it only zero out the part of the page that won't have data copied in for the write. Finally, don't set the page Uptodate after zeroing. It's not up to date since the write data won't have been copied in yet. [DH made the following changes: - Prefixed the new function with "netfs_". - Don't call zero_user_segments() for a full-page write. - Altered the beyond-last-page check to avoid a DIV instruction and got rid of then-redundant zero-length file check. ] Fixes: e1b1240c1ff5f ("netfs: Add write_begin helper") Reported-by: Andrew W Elble <> Signed-off-by: Jeff Layton <> Signed-off-by: David Howells <> Reviewed-by: Matthew Wilcox (Oracle) <> cc: Link: Link: # v1 Link: # v2
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions