On Wed 11-01-23 16:43:27, Jan Kara wrote: > In data=journal mode, page should be dirtied only when it has buffers > for checkpoint or it is writeably mapped. In the first case, we don't > need to do anything special. In the second case, page was already added > to the journal by ext4_page_mkwrite() and since transaction commit > writeprotects mapped pages again, page should be writeable (and thus > dirtied) only while it is part of the running transaction. So nothing > needs to be done either. The only special case is when someone pins the > page and uses this pin for modifying page data. So recognize this > special case and only then mark the page as having data that needs > adding to the journal. > > Signed-off-by: Jan Kara <jack@xxxxxxx> ... > static bool ext4_journalled_dirty_folio(struct address_space *mapping, > struct folio *folio) > { > WARN_ON_ONCE(!folio_buffers(folio)); > - folio_set_checked(folio); > + if (folio_may_be_dma_pinned(folio)) Bah, this should be folio_maybe_dma_pinned(). I had it there and that's what I've tested with but before submission I was laboring whether I should really keep this change or not, had it deleted for a while and then restored the change, and while doing that I've introduced this bug. :-| I'll resend with this bug fixed but before doing that I'll wait a few days whether someone has more comments. Honza > + folio_set_checked(folio); > return filemap_dirty_folio(mapping, folio); > } > > -- > 2.35.3 > -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR