Skip to content

Commit b702c83

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: fix to check available space of CP area correctly in update_ckpt_flags()
Otherwise, nat_bit area may be persisted across boundary of CP area during nat_bit rebuilding. Fixes: 94c821f ("f2fs: rebuild nat_bits during umount") Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 3e02038 commit b702c83

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/f2fs/checkpoint.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,8 +1302,8 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
13021302
unsigned long flags;
13031303

13041304
if (cpc->reason & CP_UMOUNT) {
1305-
if (le32_to_cpu(ckpt->cp_pack_total_block_count) >
1306-
sbi->blocks_per_seg - NM_I(sbi)->nat_bits_blocks) {
1305+
if (le32_to_cpu(ckpt->cp_pack_total_block_count) +
1306+
NM_I(sbi)->nat_bits_blocks > sbi->blocks_per_seg) {
13071307
clear_ckpt_flags(sbi, CP_NAT_BITS_FLAG);
13081308
f2fs_notice(sbi, "Disable nat_bits due to no space");
13091309
} else if (!is_set_ckpt_flags(sbi, CP_NAT_BITS_FLAG) &&

0 commit comments

Comments
 (0)