Re: [PATCH v1 2/5] exfat: dirty all new pages when extending valid_size
From: Chi Zhiling
Date: Wed Sep 30 2026 - 03:35:31 EST
On 9/30/26 2:16 PM, Chi Zhiling wrote:
On 9/29/26 6:26 PM, Yuezhang.Mo@xxxxxxxx wrote:
+ if (folio->mapping == mapping) {
folio_mark_dirty(folio);
+ pos = next;
Setting 'pos' under this condition may result in an infinite loop.
If we set pos unconditionally, I'm concerned that we might miss marking a folio as dirty, which could expose stale data.
I think it would be better to switch to __filemap_get_folio() in the next version. It can directly return a locked folio, so we don't need to check whether the folio has been truncated.
folio = __filemap_get_folio(mapping, index, FGP_WRITEBEGIN, 0);
Sorry, this change is incorrect.
I took another look at it, and I think this loop will not block. Reacquiring the folio is the correct approach, and do_read_cache_folio() performs the check in the same way.
+ }
folio_unlock(folio);
folio_put(folio);
- pos = next;
}
return 0;