mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2024-11-23 18:14:25 +08:00
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>
This commit is contained in:
parent
f5eb38e816
commit
60f032bbc1
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user