diff options
author | Xue jiufei <xuejiufei@huawei.com> | 2015-06-24 19:55:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-06-24 20:49:39 -0400 |
commit | 9f99ad08612ac37f3b8847b9b2e6e95a2a81ed4b (patch) | |
tree | 6907d3f30bfee6983b8f953b52120844ced831ec /fs/ocfs2/alloc.c | |
parent | 345dc681bd9acc8d7fdb6f5d3e2419c010f00bf6 (diff) |
ocfs2: return error when ocfs2_figure_merge_contig_type() fails
ocfs2_figure_merge_contig_type() still returns CONTIG_NONE when some error
occurs which will cause an unpredictable error. So return a proper errno
when ocfs2_figure_merge_contig_type() fails.
Signed-off-by: joyce.xue <xuejiufei@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r-- | fs/ocfs2/alloc.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 2d7f76e52c37..ea4c822531cc 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -4311,13 +4311,13 @@ out: | |||
4311 | return ret; | 4311 | return ret; |
4312 | } | 4312 | } |
4313 | 4313 | ||
4314 | static enum ocfs2_contig_type | 4314 | static int ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et, |
4315 | ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et, | ||
4316 | struct ocfs2_path *path, | 4315 | struct ocfs2_path *path, |
4317 | struct ocfs2_extent_list *el, int index, | 4316 | struct ocfs2_extent_list *el, int index, |
4318 | struct ocfs2_extent_rec *split_rec) | 4317 | struct ocfs2_extent_rec *split_rec, |
4318 | struct ocfs2_merge_ctxt *ctxt) | ||
4319 | { | 4319 | { |
4320 | int status; | 4320 | int status = 0; |
4321 | enum ocfs2_contig_type ret = CONTIG_NONE; | 4321 | enum ocfs2_contig_type ret = CONTIG_NONE; |
4322 | u32 left_cpos, right_cpos; | 4322 | u32 left_cpos, right_cpos; |
4323 | struct ocfs2_extent_rec *rec = NULL; | 4323 | struct ocfs2_extent_rec *rec = NULL; |
@@ -4336,8 +4336,11 @@ ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et, | |||
4336 | 4336 | ||
4337 | if (left_cpos != 0) { | 4337 | if (left_cpos != 0) { |
4338 | left_path = ocfs2_new_path_from_path(path); | 4338 | left_path = ocfs2_new_path_from_path(path); |
4339 | if (!left_path) | 4339 | if (!left_path) { |
4340 | status = -ENOMEM; | ||
4341 | mlog_errno(status); | ||
4340 | goto exit; | 4342 | goto exit; |
4343 | } | ||
4341 | 4344 | ||
4342 | status = ocfs2_find_path(et->et_ci, left_path, | 4345 | status = ocfs2_find_path(et->et_ci, left_path, |
4343 | left_cpos); | 4346 | left_cpos); |
@@ -4392,8 +4395,11 @@ ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et, | |||
4392 | goto free_left_path; | 4395 | goto free_left_path; |
4393 | 4396 | ||
4394 | right_path = ocfs2_new_path_from_path(path); | 4397 | right_path = ocfs2_new_path_from_path(path); |
4395 | if (!right_path) | 4398 | if (!right_path) { |
4399 | status = -ENOMEM; | ||
4400 | mlog_errno(status); | ||
4396 | goto free_left_path; | 4401 | goto free_left_path; |
4402 | } | ||
4397 | 4403 | ||
4398 | status = ocfs2_find_path(et->et_ci, right_path, right_cpos); | 4404 | status = ocfs2_find_path(et->et_ci, right_path, right_cpos); |
4399 | if (status) | 4405 | if (status) |
@@ -4433,7 +4439,10 @@ free_right_path: | |||
4433 | free_left_path: | 4439 | free_left_path: |
4434 | ocfs2_free_path(left_path); | 4440 | ocfs2_free_path(left_path); |
4435 | exit: | 4441 | exit: |
4436 | return ret; | 4442 | if (status == 0) |
4443 | ctxt->c_contig_type = ret; | ||
4444 | |||
4445 | return status; | ||
4437 | } | 4446 | } |
4438 | 4447 | ||
4439 | static void ocfs2_figure_contig_type(struct ocfs2_extent_tree *et, | 4448 | static void ocfs2_figure_contig_type(struct ocfs2_extent_tree *et, |
@@ -5039,9 +5048,14 @@ int ocfs2_split_extent(handle_t *handle, | |||
5039 | goto out; | 5048 | goto out; |
5040 | } | 5049 | } |
5041 | 5050 | ||
5042 | ctxt.c_contig_type = ocfs2_figure_merge_contig_type(et, path, el, | 5051 | ret = ocfs2_figure_merge_contig_type(et, path, el, |
5043 | split_index, | 5052 | split_index, |
5044 | split_rec); | 5053 | split_rec, |
5054 | &ctxt); | ||
5055 | if (ret) { | ||
5056 | mlog_errno(ret); | ||
5057 | goto out; | ||
5058 | } | ||
5045 | 5059 | ||
5046 | /* | 5060 | /* |
5047 | * The core merge / split code wants to know how much room is | 5061 | * The core merge / split code wants to know how much room is |