]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
misc: zero s_jnl_blocks when adding journal online or removing external journal
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 19 Sep 2014 01:24:26 +0000 (21:24 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 19 Sep 2014 01:24:26 +0000 (21:24 -0400)
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>
lib/ext2fs/mkjournal.c
misc/tune2fs.c

index 96b6d360e245a9cdec74335b32c3aabd719e9aa0..e6d04c4831513d170dc1a901a7a8821852a2fb11 100644 (file)
@@ -582,6 +582,8 @@ errcode_t ext2fs_add_journal_inode2(ext2_filsys fs, blk_t num_blocks,
                        goto errout;
                }
                journal_ino = st.st_ino;
+               memset(fs->super->s_jnl_blocks, 0,
+                      sizeof(fs->super->s_jnl_blocks));
        } else {
                if ((mount_flags & EXT2_MF_BUSY) &&
                    !(fs->flags & EXT2_FLAG_EXCLUSIVE)) {
index b65dab9df8bf3e1694bce2641965a3a0a2e5f0ff..fe2c8ae8b6b93aad613f33eb3b36c3864aacde49 100644 (file)
@@ -304,6 +304,7 @@ no_valid_journal:
                return 1;
        }
        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);
        ext2fs_mark_super_dirty(fs);
        fputs(_("Journal removed\n"), stdout);