From 576fada197763b3f60b37c265549bb19c7eebeb1 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 2 Sep 2019 17:44:14 -0400 Subject: [PATCH] e2fsck: make the low dtime check consistent when using the backup superblock The backup superblock may have a last mounted time of zero, if it has never been updated since the file system was created. In that case, the low dtime check may get disabled when using the backup superblock, even though subsequent e2fsck runs will end up using the low dtime check. This can cause a failure of ext4/007, since since when e2fsck is run a second time after the file system is mounted, the low dtime check will trigger the e2fsck complaint: Inode NNNN was part of the orphaned inode list. IGNORED. Signed-off-by: Theodore Ts'o --- e2fsck/pass1.c | 6 ++++-- tests/f_no/expect | 2 ++ tests/f_yes/expect | 3 ++- tests/f_yesall/expect | 3 ++- tests/f_yesthenall/expect | 3 ++- tests/f_yesthenno/expect | 3 ++- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 524577a..2b5bfa3 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -1340,8 +1340,10 @@ void e2fsck_pass1(e2fsck_t ctx) if (ctx->progress && ((ctx->progress)(ctx, 1, 0, ctx->fs->group_desc_count))) goto endit; - if ((fs->super->s_wtime < fs->super->s_inodes_count) || - (fs->super->s_mtime < fs->super->s_inodes_count) || + if ((fs->super->s_wtime && + fs->super->s_wtime < fs->super->s_inodes_count) || + (fs->super->s_mtime && + fs->super->s_mtime < fs->super->s_inodes_count) || (fs->super->s_mkfs_time && fs->super->s_mkfs_time < fs->super->s_inodes_count)) low_dtime_check = 0; diff --git a/tests/f_no/expect b/tests/f_no/expect index e7b619d..140a01f 100644 --- a/tests/f_no/expect +++ b/tests/f_no/expect @@ -12,6 +12,8 @@ Clear? no Inode 13 has an invalid extent (logical block 0, invalid physical block 888888888888, len 1) Clear? no +Inodes that were part of a corrupted orphan linked list found. Fix? no +Inode 14 was part of the orphaned inode list. IGNORED. Inode 14 is in use, but has dtime set. Fix? no Inode 14 has an invalid extent (logical block 300, invalid physical block 777777777777, len 300) diff --git a/tests/f_yes/expect b/tests/f_yes/expect index c73e620..93b04ef 100644 --- a/tests/f_yes/expect +++ b/tests/f_yes/expect @@ -12,7 +12,8 @@ Clear? yes Inode 13 has an invalid extent (logical block 0, invalid physical block 888888888888, len 1) Clear? yes -Inode 14 is in use, but has dtime set. Fix? yes +Inodes that were part of a corrupted orphan linked list found. Fix? yes +Inode 14 was part of the orphaned inode list. FIXED. Inode 14 has an invalid extent (logical block 300, invalid physical block 777777777777, len 300) Clear? yes diff --git a/tests/f_yesall/expect b/tests/f_yesall/expect index f6d3c2b..757b048 100644 --- a/tests/f_yesall/expect +++ b/tests/f_yesall/expect @@ -16,8 +16,9 @@ Inode 13 has an invalid extent (logical block 0, invalid physical block 888888888888, len 1) Clear? yes -Inode 14 is in use, but has dtime set. Fix? yes +Inodes that were part of a corrupted orphan linked list found. Fix? yes +Inode 14 was part of the orphaned inode list. FIXED. Inode 14 has an invalid extent (logical block 300, invalid physical block 777777777777, len 300) Clear? yes diff --git a/tests/f_yesthenall/expect b/tests/f_yesthenall/expect index 1fc3bde..73f35a3 100644 --- a/tests/f_yesthenall/expect +++ b/tests/f_yesthenall/expect @@ -12,7 +12,8 @@ Clear? yes Inode 13 has an invalid extent (logical block 0, invalid physical block 888888888888, len 1) Clear? yes -Inode 14 is in use, but has dtime set. Fix? yes +Inodes that were part of a corrupted orphan linked list found. Fix? yes +Inode 14 was part of the orphaned inode list. FIXED. Inode 14 has an invalid extent (logical block 300, invalid physical block 777777777777, len 300) Clear? yes diff --git a/tests/f_yesthenno/expect b/tests/f_yesthenno/expect index de55f47..94bcc6a 100644 --- a/tests/f_yesthenno/expect +++ b/tests/f_yesthenno/expect @@ -12,7 +12,8 @@ Clear? yes Inode 13 has an invalid extent (logical block 0, invalid physical block 888888888888, len 1) Clear? yes -Inode 14 is in use, but has dtime set. Fix? yes +Inodes that were part of a corrupted orphan linked list found. Fix? yes +Inode 14 was part of the orphaned inode list. FIXED. Inode 14 has an invalid extent (logical block 300, invalid physical block 777777777777, len 300) Clear? yes -- 1.8.3.1