]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
resize2fs: don't interpret bitmap shift while crossing flexbg as raid stride
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 15 Dec 2014 02:10:35 +0000 (21:10 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 15 Dec 2014 02:10:42 +0000 (21:10 -0500)
resize2fs tries to infer the RAID stride by observing differences
between the locations of adjacent block groups' block and inode
bitmaps within the block group.  If the two block groups being
compared belong to different flexbgs, however, it'll be fooled by the
large offset into thinking that the FS has an abnormally large RAID
stride.

Therefore, teach it not to get confused by crossing a flexbg.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reported-by: TR Reardon <thomas_reardon@hotmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
resize/main.c

index 9a35af0272db432016c3f7327c754c8ab07557d5..e8ff8f07310aa619824748a5252325cadd9494c3 100644 (file)
@@ -105,6 +105,7 @@ static void determine_fs_stride(ext2_filsys fs)
        unsigned long long sum;
        unsigned int    has_sb, prev_has_sb = 0, num;
        int             i_stride, b_stride;
+       int             flexbg_size = 1 << fs->super->s_log_groups_per_flex;
 
        if (fs->stride)
                return;
@@ -120,7 +121,8 @@ static void determine_fs_stride(ext2_filsys fs)
                        ext2fs_inode_bitmap_loc(fs, group - 1) -
                        fs->super->s_blocks_per_group;
                if (b_stride != i_stride ||
-                   b_stride < 0)
+                   b_stride < 0 ||
+                   (flexbg_size > 1 && (group % flexbg_size == 0)))
                        goto next;
 
                /* printf("group %d has stride %d\n", group, b_stride); */