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