This is a note to let you know that I've just added the patch titled f2fs: fix to check available space of CP area correctly in update_ckpt_flags() to the 5.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: f2fs-fix-to-check-available-space-of-cp-area-correctly-in-update_ckpt_flags.patch and it can be found in the queue-5.16 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From b702c83e2eaa2fa2d72e957c55c0321535cc8b9f Mon Sep 17 00:00:00 2001 From: Chao Yu <chao@xxxxxxxxxx> Date: Sun, 12 Dec 2021 20:28:12 +0800 Subject: f2fs: fix to check available space of CP area correctly in update_ckpt_flags() From: Chao Yu <chao@xxxxxxxxxx> commit b702c83e2eaa2fa2d72e957c55c0321535cc8b9f upstream. Otherwise, nat_bit area may be persisted across boundary of CP area during nat_bit rebuilding. Fixes: 94c821fb286b ("f2fs: rebuild nat_bits during umount") Signed-off-by: Chao Yu <chao@xxxxxxxxxx> Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/f2fs/checkpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -1302,8 +1302,8 @@ static void update_ckpt_flags(struct f2f unsigned long flags; if (cpc->reason & CP_UMOUNT) { - if (le32_to_cpu(ckpt->cp_pack_total_block_count) > - sbi->blocks_per_seg - NM_I(sbi)->nat_bits_blocks) { + if (le32_to_cpu(ckpt->cp_pack_total_block_count) + + NM_I(sbi)->nat_bits_blocks > sbi->blocks_per_seg) { clear_ckpt_flags(sbi, CP_NAT_BITS_FLAG); f2fs_notice(sbi, "Disable nat_bits due to no space"); } else if (!is_set_ckpt_flags(sbi, CP_NAT_BITS_FLAG) && Patches currently in stable-queue which might be from chao@xxxxxxxxxx are queue-5.16/f2fs-fix-to-avoid-panic-in-is_alive-if-metadata-is-inconsistent.patch queue-5.16/f2fs-fix-remove-page-failed-in-invalidate-compress-pages.patch queue-5.16/f2fs-fix-to-do-sanity-check-on-inode-type-during-garbage-collection.patch queue-5.16/f2fs-fix-to-check-available-space-of-cp-area-correctly-in-update_ckpt_flags.patch queue-5.16/f2fs-fix-to-do-sanity-check-in-is_alive.patch queue-5.16/f2fs-compress-fix-potential-deadlock-of-compress-file.patch queue-5.16/f2fs-fix-to-do-sanity-check-on-last-xattr-entry-in-__f2fs_setxattr.patch queue-5.16/f2fs-fix-to-reserve-space-for-io-align-feature.patch