mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2024-11-28 04:23:45 +08:00
misc: zero s_jnl_blocks when removing internal journal
When we're removing the internal journal (broken journal, turning it off, or adding an external journal), zero s_jnl_blocks so that they can't be picked up by accident later. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Cc: TR Reardon <thomas_reardon@hotmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
3727a0e745
commit
e690eae513
@ -549,6 +549,7 @@ static errcode_t e2fsck_journal_fix_bad_inode(e2fsck_t ctx,
|
||||
"filesystem is now ext2 only ***\n\n");
|
||||
sb->s_feature_compat &= ~EXT3_FEATURE_COMPAT_HAS_JOURNAL;
|
||||
sb->s_journal_inum = 0;
|
||||
memset(sb->s_jnl_blocks, 0, sizeof(sb->s_jnl_blocks));
|
||||
ctx->flags |= E2F_FLAG_JOURNAL_INODE;
|
||||
ctx->fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
|
||||
e2fsck_clear_recover(ctx, 1);
|
||||
|
@ -490,6 +490,7 @@ errcode_t ext2fs_add_journal_device(ext2_filsys fs, ext2_filsys journal_dev)
|
||||
fs->super->s_journal_dev = st.st_rdev;
|
||||
memcpy(fs->super->s_journal_uuid, jsb->s_uuid,
|
||||
sizeof(fs->super->s_journal_uuid));
|
||||
memset(fs->super->s_jnl_blocks, 0, sizeof(fs->super->s_jnl_blocks));
|
||||
fs->super->s_feature_compat |= EXT3_FEATURE_COMPAT_HAS_JOURNAL;
|
||||
ext2fs_mark_super_dirty(fs);
|
||||
return 0;
|
||||
|
@ -377,6 +377,7 @@ static errcode_t remove_journal_inode(ext2_filsys fs)
|
||||
return retval;
|
||||
}
|
||||
fs->super->s_journal_inum = 0;
|
||||
memset(fs->super->s_jnl_blocks, 0, sizeof(fs->super->s_jnl_blocks));
|
||||
ext2fs_mark_super_dirty(fs);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user