linux/fs/jbd2
Zhang Yi 4ba3fcdde7 jbd2,ext4: add a shrinker to release checkpointed buffers
Current metadata buffer release logic in bdev_try_to_free_page() have
a lot of use-after-free issues when umount filesystem concurrently, and
it is difficult to fix directly because ext4 is the only user of
s_op->bdev_try_to_free_page callback and we may have to add more special
refcount or lock that is only used by ext4 into the common vfs layer,
which is unacceptable.

One better solution is remove the bdev_try_to_free_page callback, but
the real problem is we cannot easily release journal_head on the
checkpointed buffer, so try_to_free_buffers() cannot release buffers and
page under memory pressure, which is more likely to trigger
out-of-memory. So we cannot remove the callback directly before we find
another way to release journal_head.

This patch introduce a shrinker to free journal_head on the checkpointed
transaction. After the journal_head got freed, try_to_free_buffers()
could free buffer properly.

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Suggested-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20210610112440.3438139-6-yi.zhang@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-06-24 10:54:49 -04:00
..
checkpoint.c jbd2,ext4: add a shrinker to release checkpointed buffers 2021-06-24 10:54:49 -04:00
commit.c block: use an on-stack bio in blkdev_issue_flush 2021-01-27 09:51:48 -07:00
journal.c jbd2,ext4: add a shrinker to release checkpointed buffers 2021-06-24 10:54:49 -04:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
recovery.c ext4: fix debug format string warning 2021-04-09 23:32:16 -04:00
revoke.c jbd2: Reserve space for revoke descriptor blocks 2019-11-05 16:00:48 -05:00
transaction.c jbd2: don't abort the journal when freeing buffers 2021-06-24 10:33:50 -04:00