* [Ocfs2-devel] [PATCH] ocfs2: Commit transactions in error cases -v2
@ 2011-10-12 7:22 Wengang Wang
2011-10-12 16:51 ` Sunil Mushran
2011-11-17 9:49 ` Joel Becker
0 siblings, 2 replies; 3+ messages in thread
From: Wengang Wang @ 2011-10-12 7:22 UTC (permalink / raw)
To: ocfs2-devel
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@oracle.com>
---
fs/ocfs2/alloc.c | 2 +-
fs/ocfs2/ioctl.c | 3 ++-
fs/ocfs2/xattr.c | 10 ++++++----
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index ed553c6..3165aeb 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -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,
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
index bc91072..5612c3d 100644
--- a/fs/ocfs2/ioctl.c
+++ b/fs/ocfs2/ioctl.c
@@ -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;
@@ -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);
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 81ecf9c..93d6c80 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -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)
--
1.7.5.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Ocfs2-devel] [PATCH] ocfs2: Commit transactions in error cases -v2
2011-10-12 7:22 [Ocfs2-devel] [PATCH] ocfs2: Commit transactions in error cases -v2 Wengang Wang
@ 2011-10-12 16:51 ` Sunil Mushran
2011-11-17 9:49 ` Joel Becker
1 sibling, 0 replies; 3+ messages in thread
From: Sunil Mushran @ 2011-10-12 16:51 UTC (permalink / raw)
To: ocfs2-devel
Acked-by: Sunil Mushran <sunil.mushran@oracle.com>
On 10/12/2011 12:22 AM, Wengang Wang wrote:
> 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@oracle.com>
> ---
> fs/ocfs2/alloc.c | 2 +-
> fs/ocfs2/ioctl.c | 3 ++-
> fs/ocfs2/xattr.c | 10 ++++++----
> 3 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
> index ed553c6..3165aeb 100644
> --- a/fs/ocfs2/alloc.c
> +++ b/fs/ocfs2/alloc.c
> @@ -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,
> diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
> index bc91072..5612c3d 100644
> --- a/fs/ocfs2/ioctl.c
> +++ b/fs/ocfs2/ioctl.c
> @@ -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;
> @@ -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);
> diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
> index 81ecf9c..93d6c80 100644
> --- a/fs/ocfs2/xattr.c
> +++ b/fs/ocfs2/xattr.c
> @@ -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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Ocfs2-devel] [PATCH] ocfs2: Commit transactions in error cases -v2
2011-10-12 7:22 [Ocfs2-devel] [PATCH] ocfs2: Commit transactions in error cases -v2 Wengang Wang
2011-10-12 16:51 ` Sunil Mushran
@ 2011-11-17 9:49 ` Joel Becker
1 sibling, 0 replies; 3+ messages in thread
From: Joel Becker @ 2011-11-17 9:49 UTC (permalink / raw)
To: ocfs2-devel
On Wed, Oct 12, 2011 at 03:22:15PM +0800, Wengang Wang wrote:
> 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@oracle.com>
This patch is now in the 'fixes' branch of ocfs2.git.
Joel
> ---
> fs/ocfs2/alloc.c | 2 +-
> fs/ocfs2/ioctl.c | 3 ++-
> fs/ocfs2/xattr.c | 10 ++++++----
> 3 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
> index ed553c6..3165aeb 100644
> --- a/fs/ocfs2/alloc.c
> +++ b/fs/ocfs2/alloc.c
> @@ -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,
> diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
> index bc91072..5612c3d 100644
> --- a/fs/ocfs2/ioctl.c
> +++ b/fs/ocfs2/ioctl.c
> @@ -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;
> @@ -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);
> diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
> index 81ecf9c..93d6c80 100644
> --- a/fs/ocfs2/xattr.c
> +++ b/fs/ocfs2/xattr.c
> @@ -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)
> --
> 1.7.5.2
>
>
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel at oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel
--
"There is no sincerer love than the love of food."
- George Bernard Shaw
http://www.jlbec.org/
jlbec at evilplan.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-17 9:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-12 7:22 [Ocfs2-devel] [PATCH] ocfs2: Commit transactions in error cases -v2 Wengang Wang
2011-10-12 16:51 ` Sunil Mushran
2011-11-17 9:49 ` 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.