[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220714135231.aull3vo44yfa6azg@quack3>
Date: Thu, 14 Jul 2022 15:52:31 +0200
From: Jan Kara <jack@...e.cz>
To: "Kiselev, Oleg" <okiselev@...zon.com>
Cc: "linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>,
Theodore Ts'o <tytso@....edu>
Subject: Re: [PATCH 2/2] ext4: avoid resizing to a partial cluster size
On Thu 30-06-22 02:17:22, Kiselev, Oleg wrote:
> This patch avoids an attempt to resize the filesystem to an
> unaligned cluster boundary. An online resize to a size that is not
> integral to cluster size results in the last iteration attempting to
> grow the fs by a negative amount, which trips a BUG_ON and leaves the fs
> with a corrupted in-memory superblock.
>
> Signed-off-by: Oleg Kiselev <okiselev@...zon.com>
> ---
...
> @@ -1624,7 +1624,8 @@ static int ext4_setup_next_flex_gd(struct super_block *sb,
>
> o_blocks_count = ext4_blocks_count(es);
>
> - if (o_blocks_count == n_blocks_count)
> + if ((o_blocks_count == n_blocks_count) ||
> + ((n_blocks_count - o_blocks_count) < sbi->s_cluster_ratio))
> return 0;
So why do you silently do nothing with unaligned size? I'd expect we should
catch this condition already in ext4_resize_fs() and return EINVAL in that
case...
Also this code does something else than what the commit log says. You
actually check whether there are less than one cluster worth of blocks
instead of checking whether n_blocks_count is properly aligned. Why is that
enough?
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists