]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.suse/ocfs2-bug-fix-for-journal-extend-in-xattr.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.suse / ocfs2-bug-fix-for-journal-extend-in-xattr.patch
CommitLineData
2cb7cef9
BS
1From: Tao Ma <tao.ma@oracle.com>
2Subject: [PATCH] ocfs2: bug-fix for journal extend in xattr.
3Patch-mainline: 2.6.28?
4References: FATE302067
5
6In ocfs2_extend_trans, when we can't extend the current
7transaction, it will commit current transaction and restart
8a new one. So if the previous credits we have allocated aren't
9used(the block isn't dirtied before our extend), we will not
10have enough credits for any future operation(it will cause jbd
11complain and bug out). So check this and re-extend it.
12
13Signed-off-by: Tao Ma <tao.ma@oracle.com>
14Signed-off-by: Mark Fasheh <mfasheh@suse.com>
15---
16 fs/ocfs2/xattr.c | 15 ++++++++++++++-
17 1 files changed, 14 insertions(+), 1 deletions(-)
18
19diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
20index 2ccffb1..ed50f9a 100644
21--- a/fs/ocfs2/xattr.c
22+++ b/fs/ocfs2/xattr.c
23@@ -1352,8 +1352,9 @@ static int ocfs2_xattr_set_entry(struct inode *inode,
24 }
25
26 if (!(flag & OCFS2_INLINE_XATTR_FL)) {
27- /*set extended attribue in external blcok*/
28+ /* set extended attribute in external block. */
29 ret = ocfs2_extend_trans(handle,
30+ OCFS2_INODE_UPDATE_CREDITS +
31 OCFS2_XATTR_BLOCK_UPDATE_CREDITS);
32 if (ret) {
33 mlog_errno(ret);
34@@ -3717,6 +3718,18 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode,
35 }
36 }
37
38+ if (handle->h_buffer_credits < credits) {
39+ /*
40+ * The journal has been restarted before, and don't
41+ * have enough space for the insertion, so extend it
42+ * here.
43+ */
44+ ret = ocfs2_extend_trans(handle, credits);
45+ if (ret) {
46+ mlog_errno(ret);
47+ goto leave;
48+ }
49+ }
50 mlog(0, "Insert %u clusters at block %llu for xattr at %u\n",
51 num_bits, block, v_start);
52 ret = ocfs2_insert_extent(osb, handle, inode, &et, v_start, block,
53--
541.5.4.5
55