You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.8 KiB
82 lines
2.8 KiB
4 years ago
|
From e9d972c483d98b6b6fc9251166a1f5c2ca37ac5e Mon Sep 17 00:00:00 2001
|
||
|
From: Lukas Czerner <lczerner@redhat.com>
|
||
|
Date: Wed, 8 Aug 2018 13:52:56 +0200
|
||
|
Subject: [PATCH 06/16] e2fsck: remove resize inode if both resize_inode and
|
||
|
meta_bg are enabled
|
||
|
|
||
|
commit 74848259f0dd42bd478f0541c94f31ccd68eac3c
|
||
|
|
||
|
Previous e2fsprogs versions allowed to create a file system with both
|
||
|
resize_inode and meta_bg enabled. This was fixed by upstream commit
|
||
|
42e77d5d ("libext2fs: don't create filesystems with meta_bg and resize_inode")
|
||
|
|
||
|
However e2fsck still does not recognize the conflict and will attempt to
|
||
|
clear and recreate resize_inode if it's corrupted due to this incompatible
|
||
|
feature combination, though it will create it in the same wrong layout.
|
||
|
|
||
|
Fix it by teaching e2fsck to recognize resize_inode and meta_bg
|
||
|
conflict and fixing it by disabling and clearing resize inode.
|
||
|
|
||
|
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
|
||
|
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
|
||
|
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
||
|
---
|
||
|
e2fsck/problem.c | 6 ++++++
|
||
|
e2fsck/problem.h | 3 +++
|
||
|
e2fsck/super.c | 8 ++++++++
|
||
|
3 files changed, 17 insertions(+)
|
||
|
|
||
|
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
|
||
|
index 83584a08..a01b2560 100644
|
||
|
--- a/e2fsck/problem.c
|
||
|
+++ b/e2fsck/problem.c
|
||
|
@@ -438,6 +438,12 @@ static struct e2fsck_problem problem_table[] = {
|
||
|
N_("@S 64bit filesystems needs extents to access the whole disk. "),
|
||
|
PROMPT_FIX, PR_PREEN_OK | PR_NO_OK},
|
||
|
|
||
|
+ /* Meta_bg and resize_inode are not compatible, disable resize_inode*/
|
||
|
+ { PR_0_DISABLE_RESIZE_INODE,
|
||
|
+ N_("Resize_@i and meta_bg features are enabled. Those features are\n"
|
||
|
+ "not compatible. Resize @i should be disabled. "),
|
||
|
+ PROMPT_FIX, 0 },
|
||
|
+
|
||
|
/* Pass 1 errors */
|
||
|
|
||
|
/* Pass 1: Checking inodes, blocks, and sizes */
|
||
|
diff --git a/e2fsck/problem.h b/e2fsck/problem.h
|
||
|
index 6cb09cfb..cf2df8ce 100644
|
||
|
--- a/e2fsck/problem.h
|
||
|
+++ b/e2fsck/problem.h
|
||
|
@@ -252,6 +252,9 @@ struct problem_context {
|
||
|
/* 64bit is set but extents are not set. */
|
||
|
#define PR_0_64BIT_WITHOUT_EXTENTS 0x000048
|
||
|
|
||
|
+/* Meta_bg and resize_inode are not compatible, remove resize_inode*/
|
||
|
+#define PR_0_DISABLE_RESIZE_INODE 0x000051
|
||
|
+
|
||
|
/*
|
||
|
* Pass 1 errors
|
||
|
*/
|
||
|
diff --git a/e2fsck/super.c b/e2fsck/super.c
|
||
|
index a6be3c69..7e2c2e4f 100644
|
||
|
--- a/e2fsck/super.c
|
||
|
+++ b/e2fsck/super.c
|
||
|
@@ -326,6 +326,14 @@ void check_resize_inode(e2fsck_t ctx)
|
||
|
|
||
|
clear_problem_context(&pctx);
|
||
|
|
||
|
+ if (fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_RESIZE_INODE &&
|
||
|
+ fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG &&
|
||
|
+ fix_problem(ctx, PR_0_DISABLE_RESIZE_INODE, &pctx)) {
|
||
|
+ fs->super->s_feature_compat &= ~EXT2_FEATURE_COMPAT_RESIZE_INODE;
|
||
|
+ fs->super->s_reserved_gdt_blocks = 0;
|
||
|
+ ext2fs_mark_super_dirty(fs);
|
||
|
+ }
|
||
|
+
|
||
|
/*
|
||
|
* If the resize inode feature isn't set, then
|
||
|
* s_reserved_gdt_blocks must be zero.
|
||
|
--
|
||
|
2.20.1
|
||
|
|