From: Theodore Ts'o Date: Mon, 18 Aug 2008 03:20:16 +0000 (-0400) Subject: resize2fs: Fix double bumping of directory in-use counts X-Git-Tag: v1.41.1~78 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c89f1b4ca5020c9ae847b13a9a680e05fe2ce5d9;p=thirdparty%2Fe2fsprogs.git resize2fs: Fix double bumping of directory in-use counts When moving directories into new block groups (which would only happen when shrinking a filesystem), resize2fs would increase the directory in-use count by 2 times the necessary value, due to a change in ext2fs_inode_alloc_stats() made in e2fsprogs 1.26. This is largely harmless, but it does result in a filesystem corruption for e2fsck to fix. Signed-off-by: "Theodore Ts'o" --- diff --git a/resize/resize2fs.c b/resize/resize2fs.c index 84db12136..6354d9aac 100644 --- a/resize/resize2fs.c +++ b/resize/resize2fs.c @@ -1122,7 +1122,6 @@ static errcode_t inode_scan_and_fix(ext2_resize_t rfs) struct ext2_inode *inode = NULL; ext2_inode_scan scan = NULL; errcode_t retval; - int group; char *block_buf = 0; ext2_ino_t start_to_move; blk_t orig_size, new_block; @@ -1242,12 +1241,6 @@ static errcode_t inode_scan_and_fix(ext2_resize_t rfs) inode, inode_size); if (retval) goto errout; - group = (new_inode-1) / EXT2_INODES_PER_GROUP(rfs->new_fs->super); - if (LINUX_S_ISDIR(inode->i_mode)) { - rfs->new_fs->group_desc[group].bg_used_dirs_count++; - ext2fs_group_desc_csum_set(rfs->new_fs, group); - } - #ifdef RESIZE2FS_DEBUG if (rfs->flags & RESIZE_DEBUG_INODEMAP) printf("Inode moved %u->%u\n", ino, new_inode);