[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180225013325.13061-2-tytso@mit.edu>
Date: Sat, 24 Feb 2018 20:33:24 -0500
From: Theodore Ts'o <tytso@....edu>
To: Ext4 Developers List <linux-ext4@...r.kernel.org>
Cc: neilb@...e.com, Theodore Ts'o <tytso@....edu>
Subject: [PATCH 2/3] tune2fs/fuse2fs/debugfs: after replaying the journal, fix up s_lastcheck
If the file system needs to have the journal replayed, but definition
it can't be freshly checked. So if the time when the file system was
last checked (s_lastcheck) is before the time it was last mounted
(s_mtime), force s_lastcheck to be before s_mtime.
This is necessary to make sure some of tune2fs's safety checks work
correctly after replaying the journal, since some of tune2fs's
operations really require that the file system be self-consistent or
grave damage can result.
Signed-off-by: Theodore Ts'o <tytso@....edu>
---
debugfs/journal.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/debugfs/journal.c b/debugfs/journal.c
index 56a68be52..c16daa5b7 100644
--- a/debugfs/journal.c
+++ b/debugfs/journal.c
@@ -250,6 +250,12 @@ static void ext2fs_clear_recover(ext2_filsys fs, int error)
/* if we had an error doing journal recovery, we need a full fsck */
if (error)
fs->super->s_state &= ~EXT2_VALID_FS;
+ /*
+ * If we replayed the journal by definition the file system
+ * was mounted since the last time it was checked
+ */
+ if (fs->super->s_lastcheck >= fs->super->s_mtime)
+ fs->super->s_lastcheck = fs->super->s_mtime - 1;
ext2fs_mark_super_dirty(fs);
}
--
2.16.1.72.g5be1f00a9a
Powered by blists - more mailing lists