Re: [PATCH -next v5 28/32] ext4: set DISKSIZE_GROW_PENDING after zeroing unaligned EOF block
| Newsgroups | org.kernel.vger.linux-ext4 |
|---|---|
| Message-ID | <[email protected]> |
> From: Zhang Yi <[email protected]> > > In the iomap buffered I/O path, data=ordered mode is not used, so the > zeroed EOF block has no implicit ordering with later i_disksize updates. > Without the pending state being set, i_disksize can be advanced past the > zeroed block before writeback completes, exposing stale data after a > crash. > > Previous patches added the consumer side of the > disksize-grow-pending mechanism: the state bit, clear and wait helpers, > and ioend tagging. Now add ext4_iomap_mark_disksize_pending() and call > it from ext4_block_zero_eof() after zeroing the tail of the block that > straddles i_disksize. > > The helper locks the folio, waits for any in-flight writeback on it to > complete, then sets EXT4_STATE_DISKSIZE_GROW_PENDING only if the folio > is still dirty. Waiting for writeback prevents folio_test_dirty() from > returning false mid-writeback, which would cause us to skip the pending > state while zeroed data is still in flight. The dirty check then avoids > setting the bit when the data has already been written back. > > Suggested-by: Jan Kara <[email protected]> > Signed-off-by: Zhang Yi <[email protected]> Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=28