bcachefs: Fix __bch2_truncate_page()
authorKent Overstreet <kent.overstreet@gmail.com>
Fri, 9 Oct 2020 04:09:20 +0000 (00:09 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:44 +0000 (17:08 -0400)
commit9ba2eb25f017800c3d00eac2bbc3c99451c3bae2
tree377cc58f33a39da93e383af39f343bdf9cc6ecaa
parent61ce38b862c17acccd0df0004d69710d8b438e99
bcachefs: Fix __bch2_truncate_page()

__bch2_truncate_page() will mark some of the blocks in a page as
unallocated. But, if the page is mmapped (and writable), every block in
the page needs to be marked dirty, else those blocks won't be written by
__bch2_writepage().

The solution is to change those userspace mappings to RO, so that we
force bch2_page_mkwrite() to be called again.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fs-io.c