[PATCH 2/2] ext4: avoid resizing to a partial cluster size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 fs/ext4/resize.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 2acc9fca99ea..8803905907de 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -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;

 	ext4_get_group_no_and_offset(sb, o_blocks_count, &group, &last);
--
2.32.0





[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux