]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.suse/ocfs2-add-ocfs2_xattr_get_nolock.patch
Updated xen patches taken from suse.
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.suse / ocfs2-add-ocfs2_xattr_get_nolock.patch
1 From: Tiger Yang <tiger.yang@oracle.com>
2 Date: Fri, 14 Nov 2008 11:16:53 +0800
3 Subject: ocfs2: add ocfs2_xattr_get_nolock
4 Patch-mainline: 2.6.29
5
6 This function does the work of ocfs2_xattr_get under an open lock.
7
8 Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
9 Signed-off-by: Mark Fasheh <mfasheh@suse.com>
10 ---
11 fs/ocfs2/xattr.c | 40 ++++++++++++++++++++++++++++------------
12 fs/ocfs2/xattr.h | 2 ++
13 2 files changed, 30 insertions(+), 12 deletions(-)
14
15 diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
16 index 2cab0d6..ba9b870 100644
17 --- a/fs/ocfs2/xattr.c
18 +++ b/fs/ocfs2/xattr.c
19 @@ -925,12 +925,8 @@ cleanup:
20 return ret;
21 }
22
23 -/* ocfs2_xattr_get()
24 - *
25 - * Copy an extended attribute into the buffer provided.
26 - * Buffer is NULL to compute the size of buffer required.
27 - */
28 -static int ocfs2_xattr_get(struct inode *inode,
29 +int ocfs2_xattr_get_nolock(struct inode *inode,
30 + struct buffer_head *di_bh,
31 int name_index,
32 const char *name,
33 void *buffer,
34 @@ -938,7 +934,6 @@ static int ocfs2_xattr_get(struct inode *inode,
35 {
36 int ret;
37 struct ocfs2_dinode *di = NULL;
38 - struct buffer_head *di_bh = NULL;
39 struct ocfs2_inode_info *oi = OCFS2_I(inode);
40 struct ocfs2_xattr_search xis = {
41 .not_found = -ENODATA,
42 @@ -953,11 +948,6 @@ static int ocfs2_xattr_get(struct inode *inode,
43 if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL))
44 ret = -ENODATA;
45
46 - ret = ocfs2_inode_lock(inode, &di_bh, 0);
47 - if (ret < 0) {
48 - mlog_errno(ret);
49 - return ret;
50 - }
51 xis.inode_bh = xbs.inode_bh = di_bh;
52 di = (struct ocfs2_dinode *)di_bh->b_data;
53
54 @@ -968,6 +958,32 @@ static int ocfs2_xattr_get(struct inode *inode,
55 ret = ocfs2_xattr_block_get(inode, name_index, name, buffer,
56 buffer_size, &xbs);
57 up_read(&oi->ip_xattr_sem);
58 +
59 + return ret;
60 +}
61 +
62 +/* ocfs2_xattr_get()
63 + *
64 + * Copy an extended attribute into the buffer provided.
65 + * Buffer is NULL to compute the size of buffer required.
66 + */
67 +static int ocfs2_xattr_get(struct inode *inode,
68 + int name_index,
69 + const char *name,
70 + void *buffer,
71 + size_t buffer_size)
72 +{
73 + int ret;
74 + struct buffer_head *di_bh = NULL;
75 +
76 + ret = ocfs2_inode_lock(inode, &di_bh, 0);
77 + if (ret < 0) {
78 + mlog_errno(ret);
79 + return ret;
80 + }
81 + ret = ocfs2_xattr_get_nolock(inode, di_bh, name_index,
82 + name, buffer, buffer_size);
83 +
84 ocfs2_inode_unlock(inode, 0);
85
86 brelse(di_bh);
87 diff --git a/fs/ocfs2/xattr.h b/fs/ocfs2/xattr.h
88 index 188ef6b..86aa10f 100644
89 --- a/fs/ocfs2/xattr.h
90 +++ b/fs/ocfs2/xattr.h
91 @@ -43,6 +43,8 @@ extern struct xattr_handler ocfs2_xattr_security_handler;
92 extern struct xattr_handler *ocfs2_xattr_handlers[];
93
94 ssize_t ocfs2_listxattr(struct dentry *, char *, size_t);
95 +int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int,
96 + const char *, void *, size_t);
97 int ocfs2_xattr_set(struct inode *, int, const char *, const void *,
98 size_t, int);
99 int ocfs2_xattr_set_handle(handle_t *, struct inode *, struct buffer_head *,
100 --
101 1.5.6
102