Skip to content

Commit 3eda41d

Browse files
Eric Whitneytytso
authored andcommitted
Revert "ext4: enforce buffer head state assertion in ext4_da_map_blocks"
This reverts commit 948ca5f. Two crash reports from users running variations on 5.15-rc4 kernels suggest that it is premature to enforce the state assertion in the original commit. Both crashes were triggered by BUG calls in that code, indicating that under some rare circumstance the buffer head state did not match a delayed allocated block at the time the block was written out. No reproducer is available. Resolving this problem will require more time than remains in the current release cycle, so reverting the original patch for the time being is necessary to avoid any instability it may cause. Signed-off-by: Eric Whitney <[email protected]> Link: https://lore.kernel.org/r/[email protected] Fixes: 948ca5f ("ext4: enforce buffer head state assertion in ext4_da_map_blocks") Signed-off-by: Theodore Ts'o <[email protected]> Cc: [email protected]
1 parent 9e1ff30 commit 3eda41d

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

fs/ext4/inode.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,16 +1711,13 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,
17111711
}
17121712

17131713
/*
1714-
* the buffer head associated with a delayed and not unwritten
1715-
* block found in the extent status cache must contain an
1716-
* invalid block number and have its BH_New and BH_Delay bits
1717-
* set, reflecting the state assigned when the block was
1718-
* initially delayed allocated
1714+
* Delayed extent could be allocated by fallocate.
1715+
* So we need to check it.
17191716
*/
1720-
if (ext4_es_is_delonly(&es)) {
1721-
BUG_ON(bh->b_blocknr != invalid_block);
1722-
BUG_ON(!buffer_new(bh));
1723-
BUG_ON(!buffer_delay(bh));
1717+
if (ext4_es_is_delayed(&es) && !ext4_es_is_unwritten(&es)) {
1718+
map_bh(bh, inode->i_sb, invalid_block);
1719+
set_buffer_new(bh);
1720+
set_buffer_delay(bh);
17241721
return 0;
17251722
}
17261723

0 commit comments

Comments
 (0)