Skip to content

Commit

Permalink
ocfs2: Commit transactions in error cases -v2
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Joel Becker <[email protected]>
  • Loading branch information
Wengang-oracle authored and jlbec committed Nov 17, 2011
1 parent 8298524 commit b8a0ae5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fs/ocfs2/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5699,7 +5699,7 @@ int ocfs2_remove_btree_range(struct inode *inode,
OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) {
mlog_errno(ret);
goto out;
goto out_commit;
}

dquot_free_space_nodirty(inode,
Expand Down
3 changes: 2 additions & 1 deletion fs/ocfs2/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
if ((oldflags & OCFS2_IMMUTABLE_FL) || ((flags ^ oldflags) &
(OCFS2_APPEND_FL | OCFS2_IMMUTABLE_FL))) {
if (!capable(CAP_LINUX_IMMUTABLE))
goto bail_unlock;
goto bail_commit;
}

ocfs2_inode->ip_attr = flags;
Expand All @@ -132,6 +132,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
if (status < 0)
mlog_errno(status);

bail_commit:
ocfs2_commit_trans(osb, handle);
bail_unlock:
ocfs2_inode_unlock(inode, 1);
Expand Down
10 changes: 6 additions & 4 deletions fs/ocfs2/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2376,16 +2376,18 @@ static int ocfs2_remove_value_outside(struct inode*inode,
}

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;
}

}

if (ctxt.meta_ac)
Expand Down

0 comments on commit b8a0ae5

Please sign in to comment.