Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933969Ab2FGE2I (ORCPT ); Thu, 7 Jun 2012 00:28:08 -0400 Received: from li9-11.members.linode.com ([67.18.176.11]:48169 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933536Ab2FGE2E (ORCPT ); Thu, 7 Jun 2012 00:28:04 -0400 Date: Thu, 7 Jun 2012 00:27:56 -0400 From: "Ted Ts'o" To: Sander Eikelenboom Cc: Kees Cook , Linus Torvalds , dm-devel@redhat.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: EXT4-fs error (device dm-42): ext4_mb_generate_buddy:741: group 1904, 32254 clusters in bitmap, 32258 in gd Message-ID: <20120607042756.GA30776@thunk.org> Mail-Followup-To: Ted Ts'o , Sander Eikelenboom , Kees Cook , Linus Torvalds , dm-devel@redhat.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org References: <471046920.20120604234941@eikelenboom.it> <20120605000356.GM29466@outflux.net> <1018371644.20120605224154@eikelenboom.it> <20120605210806.GB7182@thunk.org> <1883708187.20120606090126@eikelenboom.it> <1482118647.20120606164012@eikelenboom.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1482118647.20120606164012@eikelenboom.it> User-Agent: Mutt/1.5.20 (2009-06-14) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2820 Lines: 67 I think this patch should fix things. Could you give it a try (after re-enabling uninit_bg and then running e2fsck on the file systems)? Many thanks, - Ted commit b6b218940d47f20fc14e4d203930c575be0c65bf Author: Theodore Ts'o Date: Thu Jun 7 00:26:56 2012 -0400 ext4: fix the free blocks calculation for ext3 file systems w/ uninit_bg Ext3 filesystems that are converted to use as many ext4 file systems as possible will enable uninit_bg to speed up e2fsck times. File systems with an native ext3 layout of inode tables and block allocation bitmaps (as opposed to ext4's flex_bg layout), ext4 would sometimes incorrectly calculate the number of free blocks in an uninitialized block group. As a result, when first allocating a block in block group marked uninitalized, ext4 would incorrectly report that the file system was corrupt: EXT4-fs error (device dm-42): ext4_mb_generate_buddy:741: group 1699, 32254 clusters in bitmap, 32258 in gd Fix the calculation in ext4_num_overhead_clusters() to avoid this problem. Signed-off-by: "Theodore Ts'o" diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 99b6324..cee7812 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c @@ -90,8 +90,8 @@ unsigned ext4_num_overhead_clusters(struct super_block *sb, * unusual file system layouts. */ if (ext4_block_in_group(sb, ext4_block_bitmap(sb, gdp), block_group)) { - block_cluster = EXT4_B2C(sbi, (start - - ext4_block_bitmap(sb, gdp))); + block_cluster = EXT4_B2C(sbi, + ext4_block_bitmap(sb, gdp) - start); if (block_cluster < num_clusters) block_cluster = -1; else if (block_cluster == num_clusters) { @@ -102,7 +102,7 @@ unsigned ext4_num_overhead_clusters(struct super_block *sb, if (ext4_block_in_group(sb, ext4_inode_bitmap(sb, gdp), block_group)) { inode_cluster = EXT4_B2C(sbi, - start - ext4_inode_bitmap(sb, gdp)); + ext4_inode_bitmap(sb, gdp) - start); if (inode_cluster < num_clusters) inode_cluster = -1; else if (inode_cluster == num_clusters) { @@ -114,7 +114,7 @@ unsigned ext4_num_overhead_clusters(struct super_block *sb, itbl_blk = ext4_inode_table(sb, gdp); for (i = 0; i < sbi->s_itb_per_group; i++) { if (ext4_block_in_group(sb, itbl_blk + i, block_group)) { - c = EXT4_B2C(sbi, start - itbl_blk + i); + c = EXT4_B2C(sbi, itbl_blk + i - start); if ((c < num_clusters) || (c == inode_cluster) || (c == block_cluster) || (c == itbl_cluster)) continue; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/