From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932599AbcHIWBi (ORCPT ); Tue, 9 Aug 2016 18:01:38 -0400 Received: from ec2-52-27-115-49.us-west-2.compute.amazonaws.com ([52.27.115.49]:36638 "EHLO s-opensource.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932398AbcHIWBg (ORCPT ); Tue, 9 Aug 2016 18:01:36 -0400 From: Luis de Bethencourt To: linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, viro@zeniv.linux.org.uk, salah.triki@acm.org, Luis de Bethencourt Subject: [PATCH 2/4] befs: add check for ag_shift in superblock Date: Tue, 9 Aug 2016 23:01:24 +0100 Message-Id: <1470780086-11594-2-git-send-email-luisbg@osg.samsung.com> X-Mailer: git-send-email 2.5.1 In-Reply-To: <1470780086-11594-1-git-send-email-luisbg@osg.samsung.com> References: <1470780086-11594-1-git-send-email-luisbg@osg.samsung.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ag_shift and blocks_per_ag contain the same information in different ways, same as block_shift and block_size do. It is worth checking this two are consistent, but since blocks_per_ag isn't documented as mandatory to use some implementations of befs don't enforce this, so making it non-fatal if they don't match and just having it as a warning. Signed-off-by: Luis de Bethencourt --- fs/befs/super.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/befs/super.c b/fs/befs/super.c index dc13df8..c36745d 100644 --- a/fs/befs/super.c +++ b/fs/befs/super.c @@ -103,6 +103,13 @@ befs_check_sb(struct super_block *sb) return BEFS_ERR; } + + /* ag_shift also encodes the same information as blocks_per_ag in a + * different way, non-fatal consistency check + */ + if ((1 << befs_sb->ag_shift) != befs_sb->blocks_per_ag) + befs_error(sb, "ag_shift disagrees with blocks_per_ag."); + if (befs_sb->log_start != befs_sb->log_end || befs_sb->flags == BEFS_DIRTY) { befs_error(sb, "Filesystem not clean! There are blocks in the " "journal. You must boot into BeOS and mount this volume " -- 2.5.1