[Ocfs2-devel] [PATCH] ocfs2: Commit transactions in error cases.

Wengang Wang wen.gang.wang at oracle.com
Wed Oct 12 00:10:44 PDT 2011


On 11-10-11 10:35, Sunil Mushran wrote:
> The first two are ok. Have a comment for the last one.
> 
> On 09/25/2011 02:13 AM, Wengang Wang wrote:
> >Commit transactions in error cases.
> >
> >There are three cases found that in error cases, journal transactions are not
> >committed nor aborted. We should take care of these case by committing the
> >transactions. Otherwise, there would left a journal handle which will lead to
> >, in same process context, the comming ocfs2_start_trans() gets wrong credits.
> >
> >Signed-off-by: Wengang Wang<wen.gang.wang at oracle.com>
<snip>
> >@@ -2376,12 +2376,12 @@ static int ocfs2_remove_value_outside(struct inode*inode,
> >  		}
> >
> >  		ret = ocfs2_xattr_value_truncate(inode, vb, 0,&ctxt);
> >+		ocfs2_commit_trans(osb, ctxt.handle);
> >  		if (ret<  0) {
> >  			mlog_errno(ret);
> >  			break;
> >  		}
> >
> >-		ocfs2_commit_trans(osb, ctxt.handle);
> >  		if (ctxt.meta_ac) {
> >  			ocfs2_free_alloc_context(ctxt.meta_ac);
> >  			ctxt.meta_ac = NULL;
> 
>  		ret = ocfs2_xattr_value_truncate(inode, vb, 0,&ctxt);
> - 		if (ret<  0) {
> - 			mlog_errno(ret);
> - 			break;
> - 		}
> 
> 		ocfs2_commit_trans(osb, ctxt.handle);
>  		if (ctxt.meta_ac) {
>  			ocfs2_free_alloc_context(ctxt.meta_ac);
>  			ctxt.meta_ac = NULL;
> 
> + 		if (ret<  0) {
> + 			mlog_errno(ret);
> + 			break;
> + 		}
> 
> 
> I don't like the commit_trans() shoe horned. The above reads cleaner imo.

Agree.

thanks,
wengang.



More information about the Ocfs2-devel mailing list