diff options
author | Tao Ma <tao.ma@oracle.com> | 2009-01-07 19:21:43 -0500 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-02-02 17:20:18 -0500 |
commit | 554e7f9e043e29da79c044f7a55efe4fad40701e (patch) | |
tree | 769a30452132cedc68cd6171c17c407bf3c39464 /fs/ocfs2 | |
parent | 0e0333429a6280e6eb3c98845e4eed90d5f8078a (diff) |
ocfs2: Access the xattr bucket only before modifying it.
In ocfs2_xattr_value_truncate, we may call b-tree codes which will
extend the journal transaction. It has a potential problem that it
may let the already-accessed-but-not-dirtied buffers gone. So we'd
better access the bucket after we call ocfs2_xattr_value_truncate.
And as for the root buffer for the xattr value, b-tree code will
acess and dirty it, so we don't need to worry about it.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/xattr.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index e1d638af6ac3..915039fffe6e 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -4729,13 +4729,6 @@ static int ocfs2_xattr_bucket_value_truncate(struct inode *inode, | |||
4729 | vb.vb_xv = (struct ocfs2_xattr_value_root *) | 4729 | vb.vb_xv = (struct ocfs2_xattr_value_root *) |
4730 | (vb.vb_bh->b_data + offset % blocksize); | 4730 | (vb.vb_bh->b_data + offset % blocksize); |
4731 | 4731 | ||
4732 | ret = ocfs2_xattr_bucket_journal_access(ctxt->handle, bucket, | ||
4733 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
4734 | if (ret) { | ||
4735 | mlog_errno(ret); | ||
4736 | goto out; | ||
4737 | } | ||
4738 | |||
4739 | /* | 4732 | /* |
4740 | * From here on out we have to dirty the bucket. The generic | 4733 | * From here on out we have to dirty the bucket. The generic |
4741 | * value calls only modify one of the bucket's bhs, but we need | 4734 | * value calls only modify one of the bucket's bhs, but we need |
@@ -4748,12 +4741,18 @@ static int ocfs2_xattr_bucket_value_truncate(struct inode *inode, | |||
4748 | ret = ocfs2_xattr_value_truncate(inode, &vb, len, ctxt); | 4741 | ret = ocfs2_xattr_value_truncate(inode, &vb, len, ctxt); |
4749 | if (ret) { | 4742 | if (ret) { |
4750 | mlog_errno(ret); | 4743 | mlog_errno(ret); |
4751 | goto out_dirty; | 4744 | goto out; |
4745 | } | ||
4746 | |||
4747 | ret = ocfs2_xattr_bucket_journal_access(ctxt->handle, bucket, | ||
4748 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
4749 | if (ret) { | ||
4750 | mlog_errno(ret); | ||
4751 | goto out; | ||
4752 | } | 4752 | } |
4753 | 4753 | ||
4754 | xe->xe_value_size = cpu_to_le64(len); | 4754 | xe->xe_value_size = cpu_to_le64(len); |
4755 | 4755 | ||
4756 | out_dirty: | ||
4757 | ocfs2_xattr_bucket_journal_dirty(ctxt->handle, bucket); | 4756 | ocfs2_xattr_bucket_journal_dirty(ctxt->handle, bucket); |
4758 | 4757 | ||
4759 | out: | 4758 | out: |