[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190418112628.GD28541@quack2.suse.cz>
Date: Thu, 18 Apr 2019 13:26:28 +0200
From: Jan Kara <jack@...e.cz>
To: Theodore Ts'o <tytso@....edu>
Cc: Ext4 Developers List <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH] ext4: protect journal inode's blocks using block_validity
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@....edu>
> ---
> 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@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists