diff options
author | Theodore Ts'o <tytso@mit.edu> | 2018-02-24 18:11:19 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2018-02-24 18:11:19 -0500 |
commit | 60f032bbc16772a12953ce7f6102609b9e452554 (patch) | |
tree | 9a0e1d6c5a10ebaf7c65a988a3dcff6a355c1815 | |
parent | f5eb38e816c0a6329ae19464702b75de3f5d8ddf (diff) | |
download | e2fsprogs-60f032bbc16772a12953ce7f6102609b9e452554.tar.gz |
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@mit.edu>
-rw-r--r-- | debugfs/journal.c | 6 |
1 files changed, 6 insertions, 0 deletions
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); } |