mirror of https://github.com/vitalif/e2fsprogs
misc: zero s_jnl_blocks when adding journal online or removing external journal
Erase s_jnl_blocks when removing an external journal, or adding an internal journal online. We can't add the backup for the internal journal because we have no good way to get the indirect block or ETB addresses, so the best we can do is hope that the user runs e2fsck, which will correct that. We are motivated to erase during external journal removal to state emphatically that there's no journal. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reported-by: thomas_reardon@hotmail.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>test-maint
parent
5afdf37b56
commit
d9112409a2
|
@ -582,6 +582,8 @@ errcode_t ext2fs_add_journal_inode2(ext2_filsys fs, blk_t num_blocks,
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
journal_ino = st.st_ino;
|
journal_ino = st.st_ino;
|
||||||
|
memset(fs->super->s_jnl_blocks, 0,
|
||||||
|
sizeof(fs->super->s_jnl_blocks));
|
||||||
} else {
|
} else {
|
||||||
if ((mount_flags & EXT2_MF_BUSY) &&
|
if ((mount_flags & EXT2_MF_BUSY) &&
|
||||||
!(fs->flags & EXT2_FLAG_EXCLUSIVE)) {
|
!(fs->flags & EXT2_FLAG_EXCLUSIVE)) {
|
||||||
|
|
|
@ -304,6 +304,7 @@ no_valid_journal:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
fs->super->s_journal_dev = 0;
|
fs->super->s_journal_dev = 0;
|
||||||
|
memset(fs->super->s_jnl_blocks, 0, sizeof(fs->super->s_jnl_blocks));
|
||||||
uuid_clear(fs->super->s_journal_uuid);
|
uuid_clear(fs->super->s_journal_uuid);
|
||||||
ext2fs_mark_super_dirty(fs);
|
ext2fs_mark_super_dirty(fs);
|
||||||
fputs(_("Journal removed\n"), stdout);
|
fputs(_("Journal removed\n"), stdout);
|
||||||
|
|
Loading…
Reference in New Issue