]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
resize2fs: Fix double bumping of directory in-use counts
authorTheodore Ts'o <tytso@mit.edu>
Mon, 18 Aug 2008 03:20:16 +0000 (23:20 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 18 Aug 2008 03:20:16 +0000 (23:20 -0400)
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" <tytso@mit.edu>
resize/resize2fs.c

index 84db121368e8bc22d12b6b0c1bed91841c261cc0..6354d9aac0b4a895739d1c1efc52d1cdb25a64ff 100644 (file)
@@ -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);