aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ocfs2/suballoc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index c3c60bc3e072..0016503d83ef 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -152,7 +152,7 @@ static u32 ocfs2_bits_per_group(struct ocfs2_chain_list *cl)
152 152
153#define do_error(fmt, ...) \ 153#define do_error(fmt, ...) \
154 do{ \ 154 do{ \
155 if (clean_error) \ 155 if (resize) \
156 mlog(ML_ERROR, fmt "\n", ##__VA_ARGS__); \ 156 mlog(ML_ERROR, fmt "\n", ##__VA_ARGS__); \
157 else \ 157 else \
158 ocfs2_error(sb, fmt, ##__VA_ARGS__); \ 158 ocfs2_error(sb, fmt, ##__VA_ARGS__); \
@@ -160,7 +160,7 @@ static u32 ocfs2_bits_per_group(struct ocfs2_chain_list *cl)
160 160
161static int ocfs2_validate_gd_self(struct super_block *sb, 161static int ocfs2_validate_gd_self(struct super_block *sb,
162 struct buffer_head *bh, 162 struct buffer_head *bh,
163 int clean_error) 163 int resize)
164{ 164{
165 struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data; 165 struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data;
166 166
@@ -211,7 +211,7 @@ static int ocfs2_validate_gd_self(struct super_block *sb,
211static int ocfs2_validate_gd_parent(struct super_block *sb, 211static int ocfs2_validate_gd_parent(struct super_block *sb,
212 struct ocfs2_dinode *di, 212 struct ocfs2_dinode *di,
213 struct buffer_head *bh, 213 struct buffer_head *bh,
214 int clean_error) 214 int resize)
215{ 215{
216 unsigned int max_bits; 216 unsigned int max_bits;
217 struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data; 217 struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data;
@@ -233,8 +233,11 @@ static int ocfs2_validate_gd_parent(struct super_block *sb,
233 return -EINVAL; 233 return -EINVAL;
234 } 234 }
235 235
236 if (le16_to_cpu(gd->bg_chain) >= 236 /* In resize, we may meet the case bg_chain == cl_next_free_rec. */
237 le16_to_cpu(di->id2.i_chain.cl_next_free_rec)) { 237 if ((le16_to_cpu(gd->bg_chain) >
238 le16_to_cpu(di->id2.i_chain.cl_next_free_rec)) ||
239 ((le16_to_cpu(gd->bg_chain) ==
240 le16_to_cpu(di->id2.i_chain.cl_next_free_rec)) && !resize)) {
238 do_error("Group descriptor #%llu has bad chain %u", 241 do_error("Group descriptor #%llu has bad chain %u",
239 (unsigned long long)bh->b_blocknr, 242 (unsigned long long)bh->b_blocknr,
240 le16_to_cpu(gd->bg_chain)); 243 le16_to_cpu(gd->bg_chain));