All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH 2/2] ocfs2: do not call brelse() if group_bh is not initialized in ocfs2_group_add()
@ 2013-09-22 10:52 Younger Liu
  2013-09-27 19:06 ` Joel Becker
  0 siblings, 1 reply; 2+ messages in thread
From: Younger Liu @ 2013-09-22 10:52 UTC (permalink / raw)
  To: ocfs2-devel

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: Younger Liu <younger.liu@huawei.com>
---
 fs/ocfs2/resize.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/ocfs2/resize.c b/fs/ocfs2/resize.c
index 376750f..822ebc1 100644
--- a/fs/ocfs2/resize.c
+++ b/fs/ocfs2/resize.c
@@ -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);
 	if (ret) {
 		mlog_errno(ret);
-		goto out_unlock;
+		goto out_free_group_bh;
 	}
 
 	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)
 	if (IS_ERR(handle)) {
 		mlog_errno(PTR_ERR(handle));
 		ret = -EINVAL;
-		goto out_unlock;
+		goto out_free_group_bh;
 	}
 
 	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)
 
 out_commit:
 	ocfs2_commit_trans(osb, handle);
-out_unlock:
+
+out_free_group_bh:
 	brelse(group_bh);
+
+out_unlock:
 	brelse(main_bm_bh);
 
 	ocfs2_inode_unlock(main_bm_inode, 1);
-- 
1.7.9.7

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Ocfs2-devel] [PATCH 2/2] ocfs2: do not call brelse() if group_bh is not initialized in ocfs2_group_add()
  2013-09-22 10:52 [Ocfs2-devel] [PATCH 2/2] ocfs2: do not call brelse() if group_bh is not initialized in ocfs2_group_add() Younger Liu
@ 2013-09-27 19:06 ` Joel Becker
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Becker @ 2013-09-27 19:06 UTC (permalink / raw)
  To: ocfs2-devel

Acked-by: Joel Becker <jlbec@evilplan.org>

On Sun, Sep 22, 2013 at 06:52:04PM +0800, Younger Liu wrote:
> 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: Younger Liu <younger.liu@huawei.com>
> ---
>  fs/ocfs2/resize.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ocfs2/resize.c b/fs/ocfs2/resize.c
> index 376750f..822ebc1 100644
> --- a/fs/ocfs2/resize.c
> +++ b/fs/ocfs2/resize.c
> @@ -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);
>  	if (ret) {
>  		mlog_errno(ret);
> -		goto out_unlock;
> +		goto out_free_group_bh;
>  	}
>  
>  	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)
>  	if (IS_ERR(handle)) {
>  		mlog_errno(PTR_ERR(handle));
>  		ret = -EINVAL;
> -		goto out_unlock;
> +		goto out_free_group_bh;
>  	}
>  
>  	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)
>  
>  out_commit:
>  	ocfs2_commit_trans(osb, handle);
> -out_unlock:
> +
> +out_free_group_bh:
>  	brelse(group_bh);
> +
> +out_unlock:
>  	brelse(main_bm_bh);
>  
>  	ocfs2_inode_unlock(main_bm_inode, 1);
> -- 
> 1.7.9.7
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"The first thing we do, let's kill all the lawyers."
                                        -Henry VI, IV:ii

			http://www.jlbec.org/
			jlbec at evilplan.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-09-27 19:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-22 10:52 [Ocfs2-devel] [PATCH 2/2] ocfs2: do not call brelse() if group_bh is not initialized in ocfs2_group_add() Younger Liu
2013-09-27 19:06 ` Joel Becker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.