Blame SOURCES/e2fsprogs-1.42.9-14-libext2fs-don-t-create-filesystems-with-meta_bg-and-.patch

0ef434
From 1654b25737d2a4538964b290a75e251131fbf3c0 Mon Sep 17 00:00:00 2001
0ef434
From: Jan Kara <jack@suse.cz>
0ef434
Date: Tue, 19 Jun 2018 10:45:16 -0400
0ef434
Subject: [PATCH 04/16] libext2fs: don't create filesystems with meta_bg and
0ef434
 resize_inode
0ef434
0ef434
commit 42e77d5db53e3ec09b5dc507169d15de219799e3
0ef434
0ef434
ext2fs_initialize() may end up enabling meta_bg feature for filesystem
0ef434
which have resize_inode. Such combination is invalid to make sure we
0ef434
disable resize_inode when enabling meta_bg.
0ef434
0ef434
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
0ef434
Signed-off-by: Jan Kara <jack@suse.cz>
0ef434
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
0ef434
---
0ef434
 lib/ext2fs/initialize.c | 12 +++++++-----
0ef434
 1 file changed, 7 insertions(+), 5 deletions(-)
0ef434
0ef434
diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
0ef434
index 0b8355d8..8f0af1fb 100644
0ef434
--- a/lib/ext2fs/initialize.c
0ef434
+++ b/lib/ext2fs/initialize.c
0ef434
@@ -369,6 +369,13 @@ ipg_retry:
0ef434
 		retval = EXT2_ET_RES_GDT_BLOCKS;
0ef434
 		goto cleanup;
0ef434
 	}
0ef434
+	/* Enable meta_bg if we'd lose more than 3/4 of a BG to GDT blocks. */
0ef434
+	if (super->s_reserved_gdt_blocks + fs->desc_blocks >
0ef434
+	    super->s_blocks_per_group * 3 / 4) {
0ef434
+		fs->super->s_feature_incompat |= EXT2_FEATURE_INCOMPAT_META_BG;
0ef434
+		fs->super->s_feature_compat &= ~EXT2_FEATURE_COMPAT_RESIZE_INODE;
0ef434
+		set_field(s_reserved_gdt_blocks, 0);
0ef434
+	}
0ef434
 
0ef434
 	/*
0ef434
 	 * Calculate the maximum number of bookkeeping blocks per
0ef434
@@ -379,11 +386,6 @@ ipg_retry:
0ef434
 	overhead = (int) (3 + fs->inode_blocks_per_group +
0ef434
 			  super->s_reserved_gdt_blocks);
0ef434
 
0ef434
-	/* Enable meta_bg if we'd lose more than 3/4 of a BG to GDT blocks. */
0ef434
-	if (super->s_reserved_gdt_blocks + fs->desc_blocks >
0ef434
-	    super->s_blocks_per_group * 3 / 4)
0ef434
-		fs->super->s_feature_incompat |= EXT2_FEATURE_INCOMPAT_META_BG;
0ef434
-
0ef434
 	if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
0ef434
 		overhead++;
0ef434
 	else
0ef434
-- 
0ef434
2.20.1
0ef434