On Tue 09-04-19 23:38:59, Theodore Ts'o wrote: > Add the blocks which belong to the journal inode to block_validity's > system zone so attempts to deallocate or overwrite the journal due a > corrupted file system where the journal blocks are also claimed by > another inode. > > Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202879 > Signed-off-by: Theodore Ts'o <tytso@xxxxxxx> > --- > fs/ext4/block_validity.c | 48 ++++++++++++++++++++++++++++++++++++++++ > fs/ext4/inode.c | 4 ++++ > 2 files changed, 52 insertions(+) The patch looks good to me just two suggestions: ... > + while (i < num) { > + map.m_lblk = i; > + map.m_len = num - i; > + n = ext4_map_blocks(NULL, inode, &map, 0); > + if (n < 0) { > + err = n; > + break; > + } > + if (n == 0) { > + i++; map.m_len actually contains the hole length so you can do i += map.m_len; to skip the whole hole at once. > @@ -171,6 +213,12 @@ int ext4_setup_system_zone(struct super_block *sb) > if (ret) > return ret; > } > + if (ext4_has_feature_journal(sb) && sbi->s_es->s_journal_inum) { > + ret = ext4_protect_reserved_inode(sb, > + le32_to_cpu(sbi->s_es->s_journal_inum)); > + if (ret) > + return ret; > + } > I guess we could protect resize inode the same way? Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR