Skip to contentSkip to conversation

f2fs: make sanity_check_ckpt more strict

PATCH NAK Wang Sheng-Hui 2 participants 2 messages Jun 28, 2013 – Jul 1, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: make sanity_check_ckpt more strict

In mkfs, we have check:

    if ((le32_to_cpu(super_block.segment_count_main) - 2) <
        config.reserved_segments) {

In super.c/sanity_check_ckpt, we should make the check as strict as mkfs.

---
 fs/f2fs/super.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/super.c +1 -1
index 8555f7d..b64f38a 100644
@@ -448,7 +448,7 @@ static int sanity_check_ckpt(struct f2fs_sb_info *sbi)
 	fsmeta = le32_to_cpu(raw_super->segment_count_ckpt);
 	fsmeta += le32_to_cpu(raw_super->segment_count_sit);
 	fsmeta += le32_to_cpu(raw_super->segment_count_nat);
-	fsmeta += le32_to_cpu(ckpt->rsvd_segment_count);
+	fsmeta += le32_to_cpu(ckpt->rsvd_segment_count) + 2;
 	fsmeta += le32_to_cpu(raw_super->segment_count_ssa);
 
 	if (fsmeta >= total)
Signature · 1 line
1.7.10.4
#1 lore raw

Hi,

2013-06-28 (금), 23:23 +0800, Wang Sheng-Hui:

Quoted 3 lines

In mkfs, we have check:

     if ((le32_to_cpu(super_block.segment_count_main) - 2) <
         config.reserved_segments) {

This is not the sanity check flow.
It's just to check whether the volume size is enoughly large or not.

Quoted 14 lines

In super.c/sanity_check_ckpt, we should make the check as strict as mkfs.

---
  fs/f2fs/super.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/super.c +0 -0
index 8555f7d..b64f38a 100644

fs/f2fs/super.c static int sanity_check_ckpt(struct f2fs_sb_info *sbi) · line 451

Quoted 5 lines
fs/f2fs/super.c +1 -1
@@ -448,7 +448,7 @@ static int sanity_check_ckpt(struct f2fs_sb_info *sbi)
  	fsmeta = le32_to_cpu(raw_super->segment_count_ckpt);
  	fsmeta += le32_to_cpu(raw_super->segment_count_sit);
  	fsmeta += le32_to_cpu(raw_super->segment_count_nat);
-	fsmeta += le32_to_cpu(ckpt->rsvd_segment_count);
+	fsmeta += le32_to_cpu(ckpt->rsvd_segment_count) + 2;

NAK.
The fsmeta is used to check whether total segment count is matched to the sum of each area's segment counts.
Thanks,

Signature · 7 lines
Jaegeuk Kim
Samsung

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html