Commit 8abaae8d authored by Younger Liu's avatar Younger Liu Committed by Linus Torvalds

ocfs2: do not call brelse() if group_bh is not initialized in ocfs2_group_add()

If group_bh is not initialized, there is no need to release.  This
problem does not cause anything wrong, but the patch would make the code
more logical.
Signed-off-by: default avatarYounger Liu <younger.liu@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Acked-by: default avatarJoel Becker <jlbec@evilplan.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent eedd40e1
...@@ -514,7 +514,7 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input) ...@@ -514,7 +514,7 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input)
ret = ocfs2_verify_group_and_input(main_bm_inode, fe, input, group_bh); ret = ocfs2_verify_group_and_input(main_bm_inode, fe, input, group_bh);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out_unlock; goto out_free_group_bh;
} }
trace_ocfs2_group_add((unsigned long long)input->group, trace_ocfs2_group_add((unsigned long long)input->group,
...@@ -524,7 +524,7 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input) ...@@ -524,7 +524,7 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input)
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
mlog_errno(PTR_ERR(handle)); mlog_errno(PTR_ERR(handle));
ret = -EINVAL; ret = -EINVAL;
goto out_unlock; goto out_free_group_bh;
} }
cl_bpc = le16_to_cpu(fe->id2.i_chain.cl_bpc); cl_bpc = le16_to_cpu(fe->id2.i_chain.cl_bpc);
...@@ -577,8 +577,11 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input) ...@@ -577,8 +577,11 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input)
out_commit: out_commit:
ocfs2_commit_trans(osb, handle); ocfs2_commit_trans(osb, handle);
out_unlock:
out_free_group_bh:
brelse(group_bh); brelse(group_bh);
out_unlock:
brelse(main_bm_bh); brelse(main_bm_bh);
ocfs2_inode_unlock(main_bm_inode, 1); ocfs2_inode_unlock(main_bm_inode, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment