From: Jaegeuk Kim Subject: Re: [PATCH] f2fs: make sanity_check_ckpt more strict Date: Tue, 02 Jul 2013 08:23:37 +0900 Message-ID: <1372721017.736.11.camel@kjgkr> References: <51CDAA82.40401@gmail.com> Reply-To: jaegeuk.kim@samsung.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-fsdevel@vger.kernel.org To: Wang Sheng-Hui Return-path: Received: from mailout4.samsung.com ([203.254.224.34]:52948 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755179Ab3GAXXi convert rfc822-to-8bit (ORCPT ); Mon, 1 Jul 2013 19:23:38 -0400 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MPA0019D69B4T20@mailout4.samsung.com> for linux-fsdevel@vger.kernel.org; Tue, 02 Jul 2013 08:23:37 +0900 (KST) In-reply-to: <51CDAA82.40401@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hi, 2013-06-28 (=EA=B8=88), 23:23 +0800, Wang Sheng-Hui: > 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. >=20 > 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(-) >=20 > 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 =3D le32_to_cpu(raw_super->segment_count_ckpt); > fsmeta +=3D le32_to_cpu(raw_super->segment_count_sit); > fsmeta +=3D le32_to_cpu(raw_super->segment_count_nat); > - fsmeta +=3D le32_to_cpu(ckpt->rsvd_segment_count); > + fsmeta +=3D 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, --=20 Jaegeuk Kim Samsung -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html