From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wang Sheng-Hui Subject: [PATCH] f2fs: make sanity_check_ckpt more strict Date: Fri, 28 Jun 2013 23:23:46 +0800 Message-ID: <51CDAA82.40401@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit To: jaegeuk.kim@samsung.com, linux-fsdevel@vger.kernel.org Return-path: Received: from mail-pb0-f54.google.com ([209.85.160.54]:41373 "EHLO mail-pb0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755159Ab3F1PXz (ORCPT ); Fri, 28 Jun 2013 11:23:55 -0400 Received: by mail-pb0-f54.google.com with SMTP id ro2so2395780pbb.13 for ; Fri, 28 Jun 2013 08:23:55 -0700 (PDT) Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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. Signed-off-by: Wang Sheng-Hui --- fs/f2fs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 8555f7d..b64f38a 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -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) -- 1.7.10.4