Patchwork [V2] e2fsck: fix error in computing blocks of the ending group

login
register
mail settings
Submitter Eric Sandeen
Date July 22, 2011, 4:18 a.m.
Message ID <4E28FA31.7090405@redhat.com>
Download mbox | patch
Permalink /patch/106212/
State Accepted
Headers show

Comments

Eric Sandeen - July 22, 2011, 4:18 a.m.
From: Yongqiang Yang <xiaoqiangnk@gmail.com>

If the blocks of a filesystem is a multiple of blocks_per_group,
blocks of the ending group is computed wrongly.  Use the
new ext2fs_group_blocks_count() helper instead.

Eric Sandeen: Converted to use new blocks per group helper

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
---

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o - Sept. 16, 2011, 1:29 p.m.
On Thu, Jul 21, 2011 at 06:18:57PM -0000, Eric Sandeen wrote:
> From: Yongqiang Yang <xiaoqiangnk@gmail.com>
> 
> If the blocks of a filesystem is a multiple of blocks_per_group,
> blocks of the ending group is computed wrongly.  Use the
> new ext2fs_group_blocks_count() helper instead.
> 
> Eric Sandeen: Converted to use new blocks per group helper
> 
> Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>

Thanks applied to the next branch.  Apologies for the delay.

       	       	      	   	    	      - Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c
index f9d746c..2a28c7a 100644
--- a/e2fsck/pass5.c
+++ b/e2fsck/pass5.c
@@ -225,9 +225,8 @@  redo_counts:
 				count = 0;
 				cmp_block = fs->super->s_clusters_per_group;
 				if (group == (int)fs->group_desc_count - 1)
-					cmp_block =
-						EXT2FS_NUM_B2C(fs,
-		ext2fs_blocks_count(fs->super) % fs->super->s_blocks_per_group);
+					cmp_block = EXT2FS_NUM_B2C(fs,
+						    ext2fs_group_blocks_count(fs, group));
 			}
 
 			bitmap = 0;