diff options
author | David Howells <dhowells@redhat.com> | 2020-10-22 14:08:23 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2020-10-29 13:53:04 +0000 |
commit | f86726a69dec5df6ba051baf9265584419478b64 (patch) | |
tree | 0f4a04caa4a282b0a44b4d63b0fca1126dc33868 /fs/afs/write.c | |
parent | 65dd2d6072d393a3aa14ded8afa9a12f27d9c8ad (diff) | |
download | lwn-f86726a69dec5df6ba051baf9265584419478b64.tar.gz lwn-f86726a69dec5df6ba051baf9265584419478b64.zip |
afs: Fix afs_invalidatepage to adjust the dirty region
Fix afs_invalidatepage() to adjust the dirty region recorded in
page->private when truncating a page. If the dirty region is entirely
removed, then the private data is cleared and the page dirty state is
cleared.
Without this, if the page is truncated and then expanded again by truncate,
zeros from the expanded, but no-longer dirty region may get written back to
the server if the page gets laundered due to a conflicting 3rd-party write.
It mustn't, however, shorten the dirty region of the page if that page is
still mmapped and has been marked dirty by afs_page_mkwrite(), so a flag is
stored in page->private to record this.
Fixes: 4343d00872e1 ("afs: Get rid of the afs_writeback record")
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs/write.c')
-rw-r--r-- | fs/afs/write.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/afs/write.c b/fs/afs/write.c index 1a49f5c89342..a2511e3ad2cc 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -867,6 +867,7 @@ vm_fault_t afs_page_mkwrite(struct vm_fault *vmf) wait_on_page_writeback(vmf->page); priv = afs_page_dirty(0, PAGE_SIZE); + priv = afs_page_dirty_mmapped(priv); trace_afs_page_dirty(vnode, tracepoint_string("mkwrite"), vmf->page->index, priv); if (PagePrivate(vmf->page)) |