在 2024/11/12 16:11, Christoph Hellwig 写道:
On Tue, Nov 12, 2024 at 04:01:42PM +1030, Qu Wenruo wrote:
Although I'm still struggling on the out-of-band dirty folio (someone marked
a folio dirty without notifying the fs) handling.
No one is allowed to mark pages dirty without file system involvement.
Then iomap should go the ext4 way, warning and error out.
(the ext4_warning_inode() inside mpage_prepare_extent_to_map())
But it's not.
IIRC it's related to the get_user_page() shenanigans but not 100% sure.
The iomap writepages implementation will just mark all the folio range dirty
and start mapping.
iomap writepages (just like any other writepages) never marks folios
dirty, it clears the dirty bit.
I'm talking about the iomap_set_range_dirty() call inside
iomap_writepage_map(), for the "if (i_blocks_per_folio() > 1)" branch.
If every dirty page is going through the fs interfaces, we should not
have a dirty folio without that iomap_folio_state attached.
But iomap just ignores such case and try writeback the whole folio
range. In that case, it can cause problems like the range doesn't have
space properly reserved.
Thanks,
Qu