]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Tao Ma <tao.ma@oracle.com> |
2 | Subject: [PATCH] ocfs2: bug-fix for journal extend in xattr. | |
3 | Patch-mainline: 2.6.28? | |
4 | References: FATE302067 | |
5 | ||
6 | In ocfs2_extend_trans, when we can't extend the current | |
7 | transaction, it will commit current transaction and restart | |
8 | a new one. So if the previous credits we have allocated aren't | |
9 | used(the block isn't dirtied before our extend), we will not | |
10 | have enough credits for any future operation(it will cause jbd | |
11 | complain and bug out). So check this and re-extend it. | |
12 | ||
13 | Signed-off-by: Tao Ma <tao.ma@oracle.com> | |
14 | Signed-off-by: Mark Fasheh <mfasheh@suse.com> | |
15 | --- | |
16 | fs/ocfs2/xattr.c | 15 ++++++++++++++- | |
17 | 1 files changed, 14 insertions(+), 1 deletions(-) | |
18 | ||
19 | diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c | |
20 | index 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 | -- | |
54 | 1.5.4.5 | |
55 |