aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorTao Ma <tao.ma@oracle.com>2010-03-02 22:26:27 -0500
committerJoel Becker <joel.becker@oracle.com>2010-03-17 15:07:21 -0400
commit78c37eb0d5e6a9727b12ea0f1821795ffaa66cfe (patch)
treed789252a4335a1ac0910d34be29fe43bc4153d9c /fs/ocfs2
parentee860b6a650360c91f5d5f9a94262aad9be90015 (diff)
ocfs2: Change bg_chain check for ocfs2_validate_gd_parent.
In ocfs2_validate_gd_parent, we check bg_chain against the cl_next_free_rec of the dinode. Actually in resize, we have the chance of bg_chain == cl_next_free_rec. So add some additional condition check for it. I also rename paramter "clean_error" to "resize", since the old one is not clearly enough to indicate that we should only meet with this case in resize. btw, the correpsonding bug is http://oss.oracle.com/bugzilla/show_bug.cgi?id=1230. Signed-off-by: Tao Ma <tao.ma@oracle.com> Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-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));