]>
Commit | Line | Data |
---|---|---|
6a930a95 BS |
1 | From: Jeff Mahoney <jeffm@suse.com> |
2 | Subject: reiserfs: eliminate per-super xattr lock | |
3 | ||
4 | With the switch to using inode->i_mutex locking during lookups/creation in | |
5 | the xattr root, the per-super xattr lock is no longer needed. | |
6 | ||
7 | This patch removes it. | |
8 | ||
9 | Signed-off-by: Jeff Mahoney <jeffm@suse.com> | |
10 | -- | |
11 | fs/reiserfs/inode.c | 14 ------- | |
12 | fs/reiserfs/namei.c | 29 ---------------- | |
13 | fs/reiserfs/super.c | 4 -- | |
14 | fs/reiserfs/xattr.c | 70 +++++++++++++++++++------------------- | |
15 | fs/reiserfs/xattr_acl.c | 74 ++++++++++++++++++----------------------- | |
16 | include/linux/reiserfs_fs.h | 3 - | |
17 | include/linux/reiserfs_fs_sb.h | 3 - | |
18 | include/linux/reiserfs_xattr.h | 28 ++------------- | |
19 | 8 files changed, 74 insertions(+), 151 deletions(-) | |
20 | ||
21 | --- a/fs/reiserfs/inode.c | |
22 | +++ b/fs/reiserfs/inode.c | |
23 | @@ -1962,19 +1962,7 @@ int reiserfs_new_inode(struct reiserfs_t | |
24 | out_inserted_sd: | |
25 | inode->i_nlink = 0; | |
26 | th->t_trans_id = 0; /* so the caller can't use this handle later */ | |
27 | - | |
28 | - /* If we were inheriting an ACL, we need to release the lock so that | |
29 | - * iput doesn't deadlock in reiserfs_delete_xattrs. The locking | |
30 | - * code really needs to be reworked, but this will take care of it | |
31 | - * for now. -jeffm */ | |
32 | -#ifdef CONFIG_REISERFS_FS_POSIX_ACL | |
33 | - if (REISERFS_I(dir)->i_acl_default && !IS_ERR(REISERFS_I(dir)->i_acl_default)) { | |
34 | - reiserfs_write_unlock_xattrs(dir->i_sb); | |
35 | - iput(inode); | |
36 | - reiserfs_write_lock_xattrs(dir->i_sb); | |
37 | - } else | |
38 | -#endif | |
39 | - iput(inode); | |
40 | + iput(inode); | |
41 | return err; | |
42 | } | |
43 | ||
44 | --- a/fs/reiserfs/namei.c | |
45 | +++ b/fs/reiserfs/namei.c | |
46 | @@ -618,9 +618,6 @@ static int reiserfs_create(struct inode | |
47 | ||
48 | reiserfs_write_lock(dir->i_sb); | |
49 | ||
50 | - if (locked) | |
51 | - reiserfs_write_lock_xattrs(dir->i_sb); | |
52 | - | |
53 | retval = journal_begin(&th, dir->i_sb, jbegin_count); | |
54 | if (retval) { | |
55 | drop_new_inode(inode); | |
56 | @@ -633,11 +630,6 @@ static int reiserfs_create(struct inode | |
57 | if (retval) | |
58 | goto out_failed; | |
59 | ||
60 | - if (locked) { | |
61 | - reiserfs_write_unlock_xattrs(dir->i_sb); | |
62 | - locked = 0; | |
63 | - } | |
64 | - | |
65 | inode->i_op = &reiserfs_file_inode_operations; | |
66 | inode->i_fop = &reiserfs_file_operations; | |
67 | inode->i_mapping->a_ops = &reiserfs_address_space_operations; | |
68 | @@ -662,8 +654,6 @@ static int reiserfs_create(struct inode | |
69 | retval = journal_end(&th, dir->i_sb, jbegin_count); | |
70 | ||
71 | out_failed: | |
72 | - if (locked) | |
73 | - reiserfs_write_unlock_xattrs(dir->i_sb); | |
74 | reiserfs_write_unlock(dir->i_sb); | |
75 | return retval; | |
76 | } | |
77 | @@ -693,9 +683,6 @@ static int reiserfs_mknod(struct inode * | |
78 | ||
79 | reiserfs_write_lock(dir->i_sb); | |
80 | ||
81 | - if (locked) | |
82 | - reiserfs_write_lock_xattrs(dir->i_sb); | |
83 | - | |
84 | retval = journal_begin(&th, dir->i_sb, jbegin_count); | |
85 | if (retval) { | |
86 | drop_new_inode(inode); | |
87 | @@ -709,11 +696,6 @@ static int reiserfs_mknod(struct inode * | |
88 | goto out_failed; | |
89 | } | |
90 | ||
91 | - if (locked) { | |
92 | - reiserfs_write_unlock_xattrs(dir->i_sb); | |
93 | - locked = 0; | |
94 | - } | |
95 | - | |
96 | inode->i_op = &reiserfs_special_inode_operations; | |
97 | init_special_inode(inode, inode->i_mode, rdev); | |
98 | ||
99 | @@ -741,8 +723,6 @@ static int reiserfs_mknod(struct inode * | |
100 | retval = journal_end(&th, dir->i_sb, jbegin_count); | |
101 | ||
102 | out_failed: | |
103 | - if (locked) | |
104 | - reiserfs_write_unlock_xattrs(dir->i_sb); | |
105 | reiserfs_write_unlock(dir->i_sb); | |
106 | return retval; | |
107 | } | |
108 | @@ -772,8 +752,6 @@ static int reiserfs_mkdir(struct inode * | |
109 | locked = reiserfs_cache_default_acl(dir); | |
110 | ||
111 | reiserfs_write_lock(dir->i_sb); | |
112 | - if (locked) | |
113 | - reiserfs_write_lock_xattrs(dir->i_sb); | |
114 | ||
115 | retval = journal_begin(&th, dir->i_sb, jbegin_count); | |
116 | if (retval) { | |
117 | @@ -795,11 +773,6 @@ static int reiserfs_mkdir(struct inode * | |
118 | goto out_failed; | |
119 | } | |
120 | ||
121 | - if (locked) { | |
122 | - reiserfs_write_unlock_xattrs(dir->i_sb); | |
123 | - locked = 0; | |
124 | - } | |
125 | - | |
126 | reiserfs_update_inode_transaction(inode); | |
127 | reiserfs_update_inode_transaction(dir); | |
128 | ||
129 | @@ -827,8 +800,6 @@ static int reiserfs_mkdir(struct inode * | |
130 | d_instantiate(dentry, inode); | |
131 | retval = journal_end(&th, dir->i_sb, jbegin_count); | |
132 | out_failed: | |
133 | - if (locked) | |
134 | - reiserfs_write_unlock_xattrs(dir->i_sb); | |
135 | reiserfs_write_unlock(dir->i_sb); | |
136 | return retval; | |
137 | } | |
138 | --- a/fs/reiserfs/super.c | |
139 | +++ b/fs/reiserfs/super.c | |
140 | @@ -1644,10 +1644,6 @@ static int reiserfs_fill_super(struct su | |
141 | REISERFS_SB(s)->s_alloc_options.preallocmin = 0; | |
142 | /* Preallocate by 16 blocks (17-1) at once */ | |
143 | REISERFS_SB(s)->s_alloc_options.preallocsize = 17; | |
144 | -#ifdef CONFIG_REISERFS_FS_XATTR | |
145 | - /* Initialize the rwsem for xattr dir */ | |
146 | - init_rwsem(&REISERFS_SB(s)->xattr_dir_sem); | |
147 | -#endif | |
148 | /* setup default block allocator options */ | |
149 | reiserfs_init_alloc_options(s); | |
150 | ||
151 | --- a/fs/reiserfs/xattr.c | |
152 | +++ b/fs/reiserfs/xattr.c | |
153 | @@ -27,6 +27,12 @@ | |
154 | * these are special cases for filesystem ACLs, they are interpreted by the | |
155 | * kernel, in addition, they are negatively and positively cached and attached | |
156 | * to the inode so that unnecessary lookups are avoided. | |
157 | + * | |
158 | + * Locking works like so: | |
159 | + * The xattr root (/.reiserfs_priv/xattrs) is protected by its i_mutex. | |
160 | + * The xattr dir (/.reiserfs_priv/xattrs/<oid>.<gen>) is protected by | |
161 | + * inode->xattr_sem. | |
162 | + * The xattrs themselves are likewise protected by the xattr_sem. | |
163 | */ | |
164 | ||
165 | #include <linux/reiserfs_fs.h> | |
166 | @@ -392,16 +398,17 @@ reiserfs_delete_xattrs_filler(void *buf, | |
167 | /* This is called w/ inode->i_mutex downed */ | |
168 | int reiserfs_delete_xattrs(struct inode *inode) | |
169 | { | |
170 | - struct dentry *dir, *root; | |
171 | int err = 0; | |
172 | + struct dentry *dir, *root; | |
173 | + struct reiserfs_transaction_handle th; | |
174 | + int blocks = JOURNAL_PER_BALANCE_CNT * 2 + 2 + | |
175 | + 4 * REISERFS_QUOTA_TRANS_BLOCKS(inode->i_sb); | |
176 | ||
177 | /* Skip out, an xattr has no xattrs associated with it */ | |
178 | if (IS_PRIVATE(inode) || get_inode_sd_version(inode) == STAT_DATA_V1) | |
179 | return 0; | |
180 | ||
181 | - reiserfs_read_lock_xattrs(inode->i_sb); | |
182 | dir = open_xa_dir(inode, XATTR_REPLACE); | |
183 | - reiserfs_read_unlock_xattrs(inode->i_sb); | |
184 | if (IS_ERR(dir)) { | |
185 | err = PTR_ERR(dir); | |
186 | goto out; | |
187 | @@ -416,18 +423,26 @@ int reiserfs_delete_xattrs(struct inode | |
188 | if (err) | |
189 | goto out_dir; | |
190 | ||
191 | - /* Leftovers besides . and .. -- that's not good. */ | |
192 | - if (dir->d_inode->i_nlink <= 2) { | |
193 | - root = open_xa_root(inode->i_sb, XATTR_REPLACE); | |
194 | - reiserfs_write_lock_xattrs(inode->i_sb); | |
195 | + /* We start a transaction here to avoid a ABBA situation | |
196 | + * between the xattr root's i_mutex and the journal lock. | |
197 | + * Inode creation will inherit an ACL, which requires a | |
198 | + * lookup. The lookup locks the xattr root i_mutex with a | |
199 | + * transaction open. Inode deletion takes teh xattr root | |
200 | + * i_mutex to delete the directory and then starts a | |
201 | + * transaction inside it. Boom. This doesn't incur much | |
202 | + * additional overhead since the reiserfs_rmdir transaction | |
203 | + * will just nest inside the outer transaction. */ | |
204 | + err = journal_begin(&th, inode->i_sb, blocks); | |
205 | + if (!err) { | |
206 | + int jerror; | |
207 | + root = dget(dir->d_parent); | |
208 | mutex_lock_nested(&root->d_inode->i_mutex, I_MUTEX_XATTR); | |
209 | err = xattr_rmdir(root->d_inode, dir); | |
210 | + jerror = journal_end(&th, inode->i_sb, blocks); | |
211 | mutex_unlock(&root->d_inode->i_mutex); | |
212 | - reiserfs_write_unlock_xattrs(inode->i_sb); | |
213 | dput(root); | |
214 | - } else { | |
215 | - reiserfs_warning(inode->i_sb, "jdm-20006", | |
216 | - "Couldn't remove all entries in directory"); | |
217 | + | |
218 | + err = jerror ?: err; | |
219 | } | |
220 | ||
221 | out_dir: | |
222 | @@ -437,6 +452,9 @@ out: | |
223 | if (!err) | |
224 | REISERFS_I(inode)->i_flags = | |
225 | REISERFS_I(inode)->i_flags & ~i_has_xattr_dir; | |
226 | + else | |
227 | + reiserfs_warning(inode->i_sb, "jdm-20004", | |
228 | + "Couldn't remove all xattrs (%d)\n", err); | |
229 | return err; | |
230 | } | |
231 | ||
232 | @@ -485,9 +503,7 @@ int reiserfs_chown_xattrs(struct inode * | |
233 | if (IS_PRIVATE(inode) || get_inode_sd_version(inode) == STAT_DATA_V1) | |
234 | return 0; | |
235 | ||
236 | - reiserfs_read_lock_xattrs(inode->i_sb); | |
237 | dir = open_xa_dir(inode, XATTR_REPLACE); | |
238 | - reiserfs_read_unlock_xattrs(inode->i_sb); | |
239 | if (IS_ERR(dir)) { | |
240 | if (PTR_ERR(dir) != -ENODATA) | |
241 | err = PTR_ERR(dir); | |
242 | @@ -731,6 +747,11 @@ reiserfs_xattr_get(const struct inode *i | |
243 | goto out; | |
244 | } | |
245 | ||
246 | + /* protect against concurrent access. xattrs are backed by | |
247 | + * regular files, but they're not regular files. The updates | |
248 | + * must be atomic from the perspective of the user. */ | |
249 | + mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR); | |
250 | + | |
251 | isize = i_size_read(dentry->d_inode); | |
252 | REISERFS_I(inode)->i_flags |= i_has_xattr_dir; | |
253 | ||
254 | @@ -798,6 +819,7 @@ reiserfs_xattr_get(const struct inode *i | |
255 | } | |
256 | ||
257 | out_dput: | |
258 | + mutex_unlock(&dentry->d_inode->i_mutex); | |
259 | dput(dentry); | |
260 | ||
261 | out: | |
262 | @@ -834,7 +856,6 @@ int reiserfs_xattr_del(struct inode *ino | |
263 | static struct reiserfs_xattr_handler *find_xattr_handler_prefix(const char *); | |
264 | /* | |
265 | * Inode operation getxattr() | |
266 | - * Preliminary locking: we down dentry->d_inode->i_mutex | |
267 | */ | |
268 | ssize_t | |
269 | reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer, | |
270 | @@ -848,9 +869,7 @@ reiserfs_getxattr(struct dentry * dentry | |
271 | return -EOPNOTSUPP; | |
272 | ||
273 | reiserfs_read_lock_xattr_i(dentry->d_inode); | |
274 | - reiserfs_read_lock_xattrs(dentry->d_sb); | |
275 | err = xah->get(dentry->d_inode, name, buffer, size); | |
276 | - reiserfs_read_unlock_xattrs(dentry->d_sb); | |
277 | reiserfs_read_unlock_xattr_i(dentry->d_inode); | |
278 | return err; | |
279 | } | |
280 | @@ -866,23 +885,13 @@ reiserfs_setxattr(struct dentry *dentry, | |
281 | { | |
282 | struct reiserfs_xattr_handler *xah = find_xattr_handler_prefix(name); | |
283 | int err; | |
284 | - int lock; | |
285 | ||
286 | if (!xah || !reiserfs_xattrs(dentry->d_sb) || | |
287 | get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) | |
288 | return -EOPNOTSUPP; | |
289 | ||
290 | reiserfs_write_lock_xattr_i(dentry->d_inode); | |
291 | - lock = !has_xattr_dir(dentry->d_inode); | |
292 | - if (lock) | |
293 | - reiserfs_write_lock_xattrs(dentry->d_sb); | |
294 | - else | |
295 | - reiserfs_read_lock_xattrs(dentry->d_sb); | |
296 | err = xah->set(dentry->d_inode, name, value, size, flags); | |
297 | - if (lock) | |
298 | - reiserfs_write_unlock_xattrs(dentry->d_sb); | |
299 | - else | |
300 | - reiserfs_read_unlock_xattrs(dentry->d_sb); | |
301 | reiserfs_write_unlock_xattr_i(dentry->d_inode); | |
302 | return err; | |
303 | } | |
304 | @@ -902,8 +911,6 @@ int reiserfs_removexattr(struct dentry * | |
305 | return -EOPNOTSUPP; | |
306 | ||
307 | reiserfs_write_lock_xattr_i(dentry->d_inode); | |
308 | - reiserfs_read_lock_xattrs(dentry->d_sb); | |
309 | - | |
310 | /* Deletion pre-operation */ | |
311 | if (xah->del) { | |
312 | err = xah->del(dentry->d_inode, name); | |
313 | @@ -917,7 +924,6 @@ int reiserfs_removexattr(struct dentry * | |
314 | mark_inode_dirty(dentry->d_inode); | |
315 | ||
316 | out: | |
317 | - reiserfs_read_unlock_xattrs(dentry->d_sb); | |
318 | reiserfs_write_unlock_xattr_i(dentry->d_inode); | |
319 | return err; | |
320 | } | |
321 | @@ -966,8 +972,6 @@ reiserfs_listxattr_filler(void *buf, con | |
322 | ||
323 | /* | |
324 | * Inode operation listxattr() | |
325 | - * | |
326 | - * Preliminary locking: we down dentry->d_inode->i_mutex | |
327 | */ | |
328 | ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) | |
329 | { | |
330 | @@ -983,9 +987,7 @@ ssize_t reiserfs_listxattr(struct dentry | |
331 | return -EOPNOTSUPP; | |
332 | ||
333 | reiserfs_read_lock_xattr_i(dentry->d_inode); | |
334 | - reiserfs_read_lock_xattrs(dentry->d_sb); | |
335 | dir = open_xa_dir(dentry->d_inode, XATTR_REPLACE); | |
336 | - reiserfs_read_unlock_xattrs(dentry->d_sb); | |
337 | if (IS_ERR(dir)) { | |
338 | err = PTR_ERR(dir); | |
339 | if (err == -ENODATA) | |
340 | @@ -1114,11 +1116,9 @@ static int reiserfs_check_acl(struct ino | |
341 | int error = -EAGAIN; /* do regular unix permission checks by default */ | |
342 | ||
343 | reiserfs_read_lock_xattr_i(inode); | |
344 | - reiserfs_read_lock_xattrs(inode->i_sb); | |
345 | ||
346 | acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS); | |
347 | ||
348 | - reiserfs_read_unlock_xattrs(inode->i_sb); | |
349 | reiserfs_read_unlock_xattr_i(inode); | |
350 | ||
351 | if (acl) { | |
352 | --- a/fs/reiserfs/xattr_acl.c | |
353 | +++ b/fs/reiserfs/xattr_acl.c | |
354 | @@ -172,6 +172,29 @@ static void *posix_acl_to_disk(const str | |
355 | return ERR_PTR(-EINVAL); | |
356 | } | |
357 | ||
358 | +static inline void iset_acl(struct inode *inode, struct posix_acl **i_acl, | |
359 | + struct posix_acl *acl) | |
360 | +{ | |
361 | + spin_lock(&inode->i_lock); | |
362 | + if (*i_acl != ERR_PTR(-ENODATA)) | |
363 | + posix_acl_release(*i_acl); | |
364 | + *i_acl = posix_acl_dup(acl); | |
365 | + spin_unlock(&inode->i_lock); | |
366 | +} | |
367 | + | |
368 | +static inline struct posix_acl *iget_acl(struct inode *inode, | |
369 | + struct posix_acl **i_acl) | |
370 | +{ | |
371 | + struct posix_acl *acl = ERR_PTR(-ENODATA); | |
372 | + | |
373 | + spin_lock(&inode->i_lock); | |
374 | + if (*i_acl != ERR_PTR(-ENODATA)) | |
375 | + acl = posix_acl_dup(*i_acl); | |
376 | + spin_unlock(&inode->i_lock); | |
377 | + | |
378 | + return acl; | |
379 | +} | |
380 | + | |
381 | /* | |
382 | * Inode operation get_posix_acl(). | |
383 | * | |
384 | @@ -199,11 +222,11 @@ struct posix_acl *reiserfs_get_acl(struc | |
385 | return ERR_PTR(-EINVAL); | |
386 | } | |
387 | ||
388 | - if (IS_ERR(*p_acl)) { | |
389 | - if (PTR_ERR(*p_acl) == -ENODATA) | |
390 | - return NULL; | |
391 | - } else if (*p_acl != NULL) | |
392 | - return posix_acl_dup(*p_acl); | |
393 | + acl = iget_acl(inode, p_acl); | |
394 | + if (acl && !IS_ERR(acl)) | |
395 | + return acl; | |
396 | + else if (PTR_ERR(acl) == -ENODATA) | |
397 | + return NULL; | |
398 | ||
399 | size = reiserfs_xattr_get(inode, name, NULL, 0); | |
400 | if (size < 0) { | |
401 | @@ -229,7 +252,7 @@ struct posix_acl *reiserfs_get_acl(struc | |
402 | } else { | |
403 | acl = posix_acl_from_disk(value, retval); | |
404 | if (!IS_ERR(acl)) | |
405 | - *p_acl = posix_acl_dup(acl); | |
406 | + iset_acl(inode, p_acl, acl); | |
407 | } | |
408 | ||
409 | kfree(value); | |
410 | @@ -300,16 +323,8 @@ reiserfs_set_acl(struct inode *inode, in | |
411 | ||
412 | kfree(value); | |
413 | ||
414 | - if (!error) { | |
415 | - /* Release the old one */ | |
416 | - if (!IS_ERR(*p_acl) && *p_acl) | |
417 | - posix_acl_release(*p_acl); | |
418 | - | |
419 | - if (acl == NULL) | |
420 | - *p_acl = ERR_PTR(-ENODATA); | |
421 | - else | |
422 | - *p_acl = posix_acl_dup(acl); | |
423 | - } | |
424 | + if (!error) | |
425 | + iset_acl(inode, p_acl, acl); | |
426 | ||
427 | return error; | |
428 | } | |
429 | @@ -404,9 +419,7 @@ int reiserfs_cache_default_acl(struct in | |
430 | if (reiserfs_posixacl(inode->i_sb) && !IS_PRIVATE(inode)) { | |
431 | struct posix_acl *acl; | |
432 | reiserfs_read_lock_xattr_i(inode); | |
433 | - reiserfs_read_lock_xattrs(inode->i_sb); | |
434 | acl = reiserfs_get_acl(inode, ACL_TYPE_DEFAULT); | |
435 | - reiserfs_read_unlock_xattrs(inode->i_sb); | |
436 | reiserfs_read_unlock_xattr_i(inode); | |
437 | ret = (acl && !IS_ERR(acl)); | |
438 | if (ret) | |
439 | @@ -429,9 +442,7 @@ int reiserfs_acl_chmod(struct inode *ino | |
440 | return 0; | |
441 | } | |
442 | ||
443 | - reiserfs_read_lock_xattrs(inode->i_sb); | |
444 | acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS); | |
445 | - reiserfs_read_unlock_xattrs(inode->i_sb); | |
446 | if (!acl) | |
447 | return 0; | |
448 | if (IS_ERR(acl)) | |
449 | @@ -442,17 +453,8 @@ int reiserfs_acl_chmod(struct inode *ino | |
450 | return -ENOMEM; | |
451 | error = posix_acl_chmod_masq(clone, inode->i_mode); | |
452 | if (!error) { | |
453 | - int lock = !has_xattr_dir(inode); | |
454 | reiserfs_write_lock_xattr_i(inode); | |
455 | - if (lock) | |
456 | - reiserfs_write_lock_xattrs(inode->i_sb); | |
457 | - else | |
458 | - reiserfs_read_lock_xattrs(inode->i_sb); | |
459 | error = reiserfs_set_acl(inode, ACL_TYPE_ACCESS, clone); | |
460 | - if (lock) | |
461 | - reiserfs_write_unlock_xattrs(inode->i_sb); | |
462 | - else | |
463 | - reiserfs_read_unlock_xattrs(inode->i_sb); | |
464 | reiserfs_write_unlock_xattr_i(inode); | |
465 | } | |
466 | posix_acl_release(clone); | |
467 | @@ -480,14 +482,9 @@ posix_acl_access_set(struct inode *inode | |
468 | static int posix_acl_access_del(struct inode *inode, const char *name) | |
469 | { | |
470 | struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode); | |
471 | - struct posix_acl **acl = &reiserfs_i->i_acl_access; | |
472 | if (strlen(name) != sizeof(POSIX_ACL_XATTR_ACCESS) - 1) | |
473 | return -EINVAL; | |
474 | - if (!IS_ERR(*acl) && *acl) { | |
475 | - posix_acl_release(*acl); | |
476 | - *acl = ERR_PTR(-ENODATA); | |
477 | - } | |
478 | - | |
479 | + iset_acl(inode, &reiserfs_i->i_acl_access, ERR_PTR(-ENODATA)); | |
480 | return 0; | |
481 | } | |
482 | ||
483 | @@ -533,14 +530,9 @@ posix_acl_default_set(struct inode *inod | |
484 | static int posix_acl_default_del(struct inode *inode, const char *name) | |
485 | { | |
486 | struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode); | |
487 | - struct posix_acl **acl = &reiserfs_i->i_acl_default; | |
488 | if (strlen(name) != sizeof(POSIX_ACL_XATTR_DEFAULT) - 1) | |
489 | return -EINVAL; | |
490 | - if (!IS_ERR(*acl) && *acl) { | |
491 | - posix_acl_release(*acl); | |
492 | - *acl = ERR_PTR(-ENODATA); | |
493 | - } | |
494 | - | |
495 | + iset_acl(inode, &reiserfs_i->i_acl_default, ERR_PTR(-ENODATA)); | |
496 | return 0; | |
497 | } | |
498 | ||
499 | --- a/include/linux/reiserfs_fs.h | |
500 | +++ b/include/linux/reiserfs_fs.h | |
501 | @@ -2224,7 +2224,4 @@ int reiserfs_unpack(struct inode *inode, | |
502 | #define reiserfs_write_lock( sb ) lock_kernel() | |
503 | #define reiserfs_write_unlock( sb ) unlock_kernel() | |
504 | ||
505 | -/* xattr stuff */ | |
506 | -#define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem) | |
507 | - | |
508 | #endif /* _LINUX_REISER_FS_H */ | |
509 | --- a/include/linux/reiserfs_fs_sb.h | |
510 | +++ b/include/linux/reiserfs_fs_sb.h | |
511 | @@ -402,9 +402,6 @@ struct reiserfs_sb_info { | |
512 | spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ | |
513 | struct dentry *priv_root; /* root of /.reiserfs_priv */ | |
514 | struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */ | |
515 | -#ifdef CONFIG_REISERFS_FS_XATTR | |
516 | - struct rw_semaphore xattr_dir_sem; | |
517 | -#endif | |
518 | int j_errno; | |
519 | #ifdef CONFIG_QUOTA | |
520 | char *s_qf_names[MAXQUOTAS]; | |
521 | --- a/include/linux/reiserfs_xattr.h | |
522 | +++ b/include/linux/reiserfs_xattr.h | |
523 | @@ -67,45 +67,27 @@ extern struct reiserfs_xattr_handler use | |
524 | extern struct reiserfs_xattr_handler trusted_handler; | |
525 | extern struct reiserfs_xattr_handler security_handler; | |
526 | ||
527 | -static inline void reiserfs_write_lock_xattrs(struct super_block *sb) | |
528 | -{ | |
529 | - down_write(&REISERFS_XATTR_DIR_SEM(sb)); | |
530 | -} | |
531 | -static inline void reiserfs_write_unlock_xattrs(struct super_block *sb) | |
532 | -{ | |
533 | - up_write(&REISERFS_XATTR_DIR_SEM(sb)); | |
534 | -} | |
535 | -static inline void reiserfs_read_lock_xattrs(struct super_block *sb) | |
536 | -{ | |
537 | - down_read(&REISERFS_XATTR_DIR_SEM(sb)); | |
538 | -} | |
539 | - | |
540 | -static inline void reiserfs_read_unlock_xattrs(struct super_block *sb) | |
541 | -{ | |
542 | - up_read(&REISERFS_XATTR_DIR_SEM(sb)); | |
543 | -} | |
544 | - | |
545 | static inline void reiserfs_write_lock_xattr_i(struct inode *inode) | |
546 | { | |
547 | - down_write(&REISERFS_I(inode)->xattr_sem); | |
548 | + down_write(&REISERFS_I(inode)->i_xattr_sem); | |
549 | } | |
550 | static inline void reiserfs_write_unlock_xattr_i(struct inode *inode) | |
551 | { | |
552 | - up_write(&REISERFS_I(inode)->xattr_sem); | |
553 | + up_write(&REISERFS_I(inode)->i_xattr_sem); | |
554 | } | |
555 | static inline void reiserfs_read_lock_xattr_i(struct inode *inode) | |
556 | { | |
557 | - down_read(&REISERFS_I(inode)->xattr_sem); | |
558 | + down_read(&REISERFS_I(inode)->i_xattr_sem); | |
559 | } | |
560 | ||
561 | static inline void reiserfs_read_unlock_xattr_i(struct inode *inode) | |
562 | { | |
563 | - up_read(&REISERFS_I(inode)->xattr_sem); | |
564 | + up_read(&REISERFS_I(inode)->i_xattr_sem); | |
565 | } | |
566 | ||
567 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) | |
568 | { | |
569 | - init_rwsem(&REISERFS_I(inode)->xattr_sem); | |
570 | + init_rwsem(&REISERFS_I(inode)->i_xattr_sem); | |
571 | } | |
572 | ||
573 | #else |