From: Tiger Yang <tiger.yang@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 1/1] ocfs2: recover transaction credits after extend it in xattr_set
Date: Thu, 04 Dec 2008 13:31:45 +0800 [thread overview]
Message-ID: <49376B41.1010301@oracle.com> (raw)
In-Reply-To: <1227779987-14553-1-git-send-email-tiger.yang@oracle.com>
Mark,
forget about this patch. Tao and I will find out an other solution to
solve this problem.
thanks,
tiger
Tiger Yang wrote:
> ocfs2_extend_trans may commit old credits and start with new credits.
> In normal xattr set porcess, we don't worry about this, because we have
> already dirtied all the old journal before extend_trans.
> During mknod process, we may set two acl entries and one security entry
> in same transaction, then we may call journal_dirty many times.
> So the credits must be recoverd after extend_trans in that case.
>
> Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
> ---
> fs/ocfs2/xattr.c | 14 ++++++++++----
> 1 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
> index 7e0d62a..5262dd5 100644
> --- a/fs/ocfs2/xattr.c
> +++ b/fs/ocfs2/xattr.c
> @@ -1138,7 +1138,7 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode,
> const void *value,
> int value_len)
> {
> - int ret = 0, i, cp_len, credits;
> + int ret = 0, i, cp_len, credits, old_credits;
> u16 blocksize = inode->i_sb->s_blocksize;
> u32 p_cluster, num_clusters;
> u32 cpos = 0, bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1);
> @@ -1149,11 +1149,11 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode,
> BUG_ON(clusters > le32_to_cpu(xv->xr_clusters));
>
> /*
> - * In __ocfs2_xattr_set_value_outside has already been dirtied,
> - * so we don't need to worry about whether ocfs2_extend_trans
> - * will create a new transactio for us or not.
> + * Because ocfs2_extend_trans may commit old credits and start with
> + * new credits, we need recover the old credits in that case.
> */
> credits = clusters * bpc;
> + old_credits = handle->h_buffer_credits;
> ret = ocfs2_extend_trans(handle, credits);
> if (ret) {
> mlog_errno(ret);
> @@ -1211,6 +1211,12 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode,
> }
> cpos += num_clusters;
> }
> +
> + if (handle->h_buffer_credits < old_credits) {
> + ret = ocfs2_extend_trans(handle, old_credits);
> + if (ret)
> + mlog_errno(ret);
> + }
> out:
> brelse(bh);
>
prev parent reply other threads:[~2008-12-04 5:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-27 9:59 [Ocfs2-devel] [PATCH 1/1] ocfs2: recover transaction credits after extend it in xattr_set Tiger Yang
2008-12-04 5:31 ` Tiger Yang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49376B41.1010301@oracle.com \
--to=tiger.yang@oracle.com \
--cc=ocfs2-devel@oss.oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.