Blame SOURCES/e2fsprogs-1.43.6-libext2fs-skip-start_blk-adjustment-when-stride-and-.patch

ec15cf
From 086d0f865d08ec8f723ef6a7feeb8ec8d9f3e9b5 Mon Sep 17 00:00:00 2001
ec15cf
From: Lukas Czerner <lczerner@redhat.com>
ec15cf
Date: Sat, 14 Oct 2017 10:42:30 -0400
ec15cf
Subject: [PATCH] libext2fs: skip start_blk adjustment when stride and flex_bg
ec15cf
 is set
ec15cf
ec15cf
Currently some stride optimization is done in
ec15cf
ext2fs_allocate_group_table() by adjusting start_blk block where we
ec15cf
start allocating block, or inode bitmaps.
ec15cf
ec15cf
However in flex_bg case this is currently useless since the values are
ec15cf
going to be overridden anyway. Moreover in flex_bg case the group might
ec15cf
already be full and the stride optimization will fail. As a result file
ec15cf
system resize might fail needlessly in some situations.
ec15cf
ec15cf
It can be shown by this example:
ec15cf
ec15cf
mke2fs -b 1024 -i 1024 -E stride=8192 -t ext4 /dev/loop0 1024000
ec15cf
resize2fs /dev/loop0 102400000
ec15cf
resize2fs 1.43.5 (04-Aug-2017)
ec15cf
Resizing the filesystem on /dev/loop0 to 102400000 (1k) blocks.
ec15cf
./resize/resize2fs: Could not allocate block in ext2 filesystem while trying to resize /dev/loop0
ec15cf
Please run 'e2fsck -fy /dev/loop0' to fix the filesystem
ec15cf
after the aborted resize operation.
ec15cf
ec15cf
Fix this by not doing the stride adjustment in case of flex_bg.
ec15cf
ec15cf
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
ec15cf
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
ec15cf
---
ec15cf
 lib/ext2fs/alloc_tables.c | 2 +-
ec15cf
 1 file changed, 1 insertion(+), 1 deletion(-)
ec15cf
ec15cf
diff --git a/lib/ext2fs/alloc_tables.c b/lib/ext2fs/alloc_tables.c
ec15cf
index 9f3d4e0..dd6015e 100644
ec15cf
--- a/lib/ext2fs/alloc_tables.c
ec15cf
+++ b/lib/ext2fs/alloc_tables.c
ec15cf
@@ -108,7 +108,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
ec15cf
 	/*
ec15cf
 	 * Allocate the block and inode bitmaps, if necessary
ec15cf
 	 */
ec15cf
-	if (fs->stride) {
ec15cf
+	if (fs->stride && !flexbg_size) {
ec15cf
 		retval = ext2fs_get_free_blocks2(fs, group_blk, last_blk,
ec15cf
 						 1, bmap, &start_blk);
ec15cf
 		if (retval)
ec15cf
-- 
ec15cf
2.7.5
ec15cf