[Devel] [PATCH RHEL7 COMMIT] ms ext4: fix online resize with a non-standard blocks per group setting

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jun 22 03:38:58 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.15
------>
commit 938f62ca5c6d6e1f2df4a5331f9a739bf03c1613
Author: Theodore Ts'o <tytso at mit.edu>
Date:   Mon Jun 22 14:38:58 2015 +0400

    ms ext4: fix online resize with a non-standard blocks per group setting
    
    https://jira.sw.ru/browse/PSBM-24924
    
    Original commit 3d2660d0c9c2f296837078c189b68a47f6b2e3b5
    [PATCH] ext4: fix online resize with a non-standard blocks per group setting
    
    The set_flexbg_block_bitmap() function assumed that the number of
    blocks in a blockgroup was sb->blocksize * 8, which is normally true,
    but not always!  Use EXT4_BLOCKS_PER_GROUP(sb) instead, to fix block
    bitmap corruption after:
    
    mke2fs -t ext4 -g 3072 -i 4096 /dev/vdd 1G
    mount -t ext4 /dev/vdd /vdd
    resize2fs /dev/vdd 8G
    
    Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 fs/ext4/resize.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 9579efd..c1568ec 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -401,7 +401,7 @@ static int set_flexbg_block_bitmap(struct super_block *sb, handle_t *handle,
 		start = ext4_group_first_block_no(sb, group);
 		group -= flex_gd->groups[0].group;
 
-		count2 = sb->s_blocksize * 8 - (block - start);
+		count2 = EXT4_BLOCKS_PER_GROUP(sb) - (block - start);
 		if (count2 > count)
 			count2 = count;
 



More information about the Devel mailing list