Skip to content

Commit dae9996

Browse files
jankaratytso
authored andcommitted
ext4: stop providing .writepage hook
Now we don't need .writepage hook for anything anymore. Reclaim is fine with relying on .writepages to clean pages and we often couldn't do much from the .writepage callback anyway. We only need to provide .migrate_folio callback for the ext4_journalled_aops - let's use buffer_migrate_page_norefs() there so that buffers cannot be modified under jdb2's hands as that can cause data corruption. For example when commit code does writeout of transaction buffers in jbd2_journal_write_metadata_buffer(), we don't hold page lock or have page writeback bit set or have the buffer locked. So page migration code would go and happily migrate the page elsewhere while the copy is running thus corrupting data. Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent e26355e commit dae9996

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

fs/ext4/inode.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3725,7 +3725,6 @@ static int ext4_iomap_swap_activate(struct swap_info_struct *sis,
37253725
static const struct address_space_operations ext4_aops = {
37263726
.read_folio = ext4_read_folio,
37273727
.readahead = ext4_readahead,
3728-
.writepage = ext4_writepage,
37293728
.writepages = ext4_writepages,
37303729
.write_begin = ext4_write_begin,
37313730
.write_end = ext4_write_end,
@@ -3743,7 +3742,6 @@ static const struct address_space_operations ext4_aops = {
37433742
static const struct address_space_operations ext4_journalled_aops = {
37443743
.read_folio = ext4_read_folio,
37453744
.readahead = ext4_readahead,
3746-
.writepage = ext4_writepage,
37473745
.writepages = ext4_writepages,
37483746
.write_begin = ext4_write_begin,
37493747
.write_end = ext4_journalled_write_end,
@@ -3752,6 +3750,7 @@ static const struct address_space_operations ext4_journalled_aops = {
37523750
.invalidate_folio = ext4_journalled_invalidate_folio,
37533751
.release_folio = ext4_release_folio,
37543752
.direct_IO = noop_direct_IO,
3753+
.migrate_folio = buffer_migrate_folio_norefs,
37553754
.is_partially_uptodate = block_is_partially_uptodate,
37563755
.error_remove_page = generic_error_remove_page,
37573756
.swap_activate = ext4_iomap_swap_activate,
@@ -3760,7 +3759,6 @@ static const struct address_space_operations ext4_journalled_aops = {
37603759
static const struct address_space_operations ext4_da_aops = {
37613760
.read_folio = ext4_read_folio,
37623761
.readahead = ext4_readahead,
3763-
.writepage = ext4_writepage,
37643762
.writepages = ext4_writepages,
37653763
.write_begin = ext4_da_write_begin,
37663764
.write_end = ext4_da_write_end,

0 commit comments

Comments
 (0)