[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-ext4
Subject: [PATCH 2/2] ext4: avoid resizing to a partial cluster size
From: "Kiselev, Oleg" <okiselev () amazon ! com>
Date: 2022-06-30 2:17:22
Message-ID: 9CDF7393-5645-4E8A-9D68-01CF7F4C4955 () amazon ! com
[Download RAW message or body]
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@amazon.com>
---
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic