]> git.baikalelectronics.ru Git - kernel.git/commit
afs: Fix afs_invalidatepage to adjust the dirty region
authorDavid Howells <dhowells@redhat.com>
Thu, 22 Oct 2020 13:08:23 +0000 (14:08 +0100)
committerDavid Howells <dhowells@redhat.com>
Thu, 29 Oct 2020 13:53:04 +0000 (13:53 +0000)
commit7c4cbda4c6436c605d00282557005f95d663fe77
tree0f4a04caa4a282b0a44b4d63b0fca1126dc33868
parent95fecd7d94b245a48114b70be2eada7603aec63f
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: 58fd51d5e04a ("afs: Get rid of the afs_writeback record")
Signed-off-by: David Howells <dhowells@redhat.com>
fs/afs/file.c
fs/afs/internal.h
fs/afs/write.c
include/trace/events/afs.h