aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs')
-rw-r--r--fs/reiserfs/do_balan.c8
-rw-r--r--fs/reiserfs/fix_node.c8
-rw-r--r--fs/reiserfs/ioctl.c63
-rw-r--r--fs/reiserfs/journal.c2
-rw-r--r--fs/reiserfs/lbalance.c2
-rw-r--r--fs/reiserfs/namei.c2
-rw-r--r--fs/reiserfs/super.c2
-rw-r--r--fs/reiserfs/xattr.c111
8 files changed, 84 insertions, 114 deletions
diff --git a/fs/reiserfs/do_balan.c b/fs/reiserfs/do_balan.c
index f85c5cf4934c..7ee4208793b6 100644
--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -283,7 +283,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
283 return balance_leaf_when_delete(tb, flag); 283 return balance_leaf_when_delete(tb, flag);
284 284
285 zeros_num = 0; 285 zeros_num = 0;
286 if (flag == M_INSERT && body == 0) 286 if (flag == M_INSERT && !body)
287 zeros_num = ih_item_len(ih); 287 zeros_num = ih_item_len(ih);
288 288
289 pos_in_item = tb->tb_path->pos_in_item; 289 pos_in_item = tb->tb_path->pos_in_item;
@@ -1728,7 +1728,7 @@ struct buffer_head *get_FEB(struct tree_balance *tb)
1728 struct buffer_info bi; 1728 struct buffer_info bi;
1729 1729
1730 for (i = 0; i < MAX_FEB_SIZE; i++) 1730 for (i = 0; i < MAX_FEB_SIZE; i++)
1731 if (tb->FEB[i] != 0) 1731 if (tb->FEB[i] != NULL)
1732 break; 1732 break;
1733 1733
1734 if (i == MAX_FEB_SIZE) 1734 if (i == MAX_FEB_SIZE)
@@ -1827,7 +1827,7 @@ int get_left_neighbor_position(struct tree_balance *tb, int h)
1827{ 1827{
1828 int Sh_position = PATH_H_POSITION(tb->tb_path, h + 1); 1828 int Sh_position = PATH_H_POSITION(tb->tb_path, h + 1);
1829 1829
1830 RFALSE(PATH_H_PPARENT(tb->tb_path, h) == 0 || tb->FL[h] == 0, 1830 RFALSE(PATH_H_PPARENT(tb->tb_path, h) == NULL || tb->FL[h] == NULL,
1831 "vs-12325: FL[%d](%p) or F[%d](%p) does not exist", 1831 "vs-12325: FL[%d](%p) or F[%d](%p) does not exist",
1832 h, tb->FL[h], h, PATH_H_PPARENT(tb->tb_path, h)); 1832 h, tb->FL[h], h, PATH_H_PPARENT(tb->tb_path, h));
1833 1833
@@ -1841,7 +1841,7 @@ int get_right_neighbor_position(struct tree_balance *tb, int h)
1841{ 1841{
1842 int Sh_position = PATH_H_POSITION(tb->tb_path, h + 1); 1842 int Sh_position = PATH_H_POSITION(tb->tb_path, h + 1);
1843 1843
1844 RFALSE(PATH_H_PPARENT(tb->tb_path, h) == 0 || tb->FR[h] == 0, 1844 RFALSE(PATH_H_PPARENT(tb->tb_path, h) == NULL || tb->FR[h] == NULL,
1845 "vs-12330: F[%d](%p) or FR[%d](%p) does not exist", 1845 "vs-12330: F[%d](%p) or FR[%d](%p) does not exist",
1846 h, PATH_H_PPARENT(tb->tb_path, h), h, tb->FR[h]); 1846 h, PATH_H_PPARENT(tb->tb_path, h), h, tb->FR[h]);
1847 1847
diff --git a/fs/reiserfs/fix_node.c b/fs/reiserfs/fix_node.c
index 0ee35c6c9b72..07d05e0842b7 100644
--- a/fs/reiserfs/fix_node.c
+++ b/fs/reiserfs/fix_node.c
@@ -153,7 +153,7 @@ static void create_virtual_node(struct tree_balance *tb, int h)
153 if (vn->vn_mode == M_INSERT) { 153 if (vn->vn_mode == M_INSERT) {
154 struct virtual_item *vi = vn->vn_vi + vn->vn_affected_item_num; 154 struct virtual_item *vi = vn->vn_vi + vn->vn_affected_item_num;
155 155
156 RFALSE(vn->vn_ins_ih == 0, 156 RFALSE(vn->vn_ins_ih == NULL,
157 "vs-8040: item header of inserted item is not specified"); 157 "vs-8040: item header of inserted item is not specified");
158 vi->vi_item_len = tb->insert_size[0]; 158 vi->vi_item_len = tb->insert_size[0];
159 vi->vi_ih = vn->vn_ins_ih; 159 vi->vi_ih = vn->vn_ins_ih;
@@ -857,7 +857,8 @@ static int get_lfree(struct tree_balance *tb, int h)
857 struct buffer_head *l, *f; 857 struct buffer_head *l, *f;
858 int order; 858 int order;
859 859
860 if ((f = PATH_H_PPARENT(tb->tb_path, h)) == 0 || (l = tb->FL[h]) == 0) 860 if ((f = PATH_H_PPARENT(tb->tb_path, h)) == NULL ||
861 (l = tb->FL[h]) == NULL)
861 return 0; 862 return 0;
862 863
863 if (f == l) 864 if (f == l)
@@ -878,7 +879,8 @@ static int get_rfree(struct tree_balance *tb, int h)
878 struct buffer_head *r, *f; 879 struct buffer_head *r, *f;
879 int order; 880 int order;
880 881
881 if ((f = PATH_H_PPARENT(tb->tb_path, h)) == 0 || (r = tb->FR[h]) == 0) 882 if ((f = PATH_H_PPARENT(tb->tb_path, h)) == NULL ||
883 (r = tb->FR[h]) == NULL)
882 return 0; 884 return 0;
883 885
884 if (f == r) 886 if (f == r)
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
index e0f0f098a523..74363a7aacbc 100644
--- a/fs/reiserfs/ioctl.c
+++ b/fs/reiserfs/ioctl.c
@@ -4,6 +4,7 @@
4 4
5#include <linux/capability.h> 5#include <linux/capability.h>
6#include <linux/fs.h> 6#include <linux/fs.h>
7#include <linux/mount.h>
7#include <linux/reiserfs_fs.h> 8#include <linux/reiserfs_fs.h>
8#include <linux/time.h> 9#include <linux/time.h>
9#include <asm/uaccess.h> 10#include <asm/uaccess.h>
@@ -25,6 +26,7 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
25 unsigned long arg) 26 unsigned long arg)
26{ 27{
27 unsigned int flags; 28 unsigned int flags;
29 int err = 0;
28 30
29 switch (cmd) { 31 switch (cmd) {
30 case REISERFS_IOC_UNPACK: 32 case REISERFS_IOC_UNPACK:
@@ -48,50 +50,67 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
48 if (!reiserfs_attrs(inode->i_sb)) 50 if (!reiserfs_attrs(inode->i_sb))
49 return -ENOTTY; 51 return -ENOTTY;
50 52
51 if (IS_RDONLY(inode)) 53 err = mnt_want_write(filp->f_path.mnt);
52 return -EROFS; 54 if (err)
55 return err;
53 56
54 if (!is_owner_or_cap(inode)) 57 if (!is_owner_or_cap(inode)) {
55 return -EPERM; 58 err = -EPERM;
56 59 goto setflags_out;
57 if (get_user(flags, (int __user *)arg)) 60 }
58 return -EFAULT; 61 if (get_user(flags, (int __user *)arg)) {
59 62 err = -EFAULT;
60 /* Is it quota file? Do not allow user to mess with it. */ 63 goto setflags_out;
61 if (IS_NOQUOTA(inode)) 64 }
62 return -EPERM; 65 /*
66 * Is it quota file? Do not allow user to mess with it
67 */
68 if (IS_NOQUOTA(inode)) {
69 err = -EPERM;
70 goto setflags_out;
71 }
63 if (((flags ^ REISERFS_I(inode)-> 72 if (((flags ^ REISERFS_I(inode)->
64 i_attrs) & (REISERFS_IMMUTABLE_FL | 73 i_attrs) & (REISERFS_IMMUTABLE_FL |
65 REISERFS_APPEND_FL)) 74 REISERFS_APPEND_FL))
66 && !capable(CAP_LINUX_IMMUTABLE)) 75 && !capable(CAP_LINUX_IMMUTABLE)) {
67 return -EPERM; 76 err = -EPERM;
68 77 goto setflags_out;
78 }
69 if ((flags & REISERFS_NOTAIL_FL) && 79 if ((flags & REISERFS_NOTAIL_FL) &&
70 S_ISREG(inode->i_mode)) { 80 S_ISREG(inode->i_mode)) {
71 int result; 81 int result;
72 82
73 result = reiserfs_unpack(inode, filp); 83 result = reiserfs_unpack(inode, filp);
74 if (result) 84 if (result) {
75 return result; 85 err = result;
86 goto setflags_out;
87 }
76 } 88 }
77 sd_attrs_to_i_attrs(flags, inode); 89 sd_attrs_to_i_attrs(flags, inode);
78 REISERFS_I(inode)->i_attrs = flags; 90 REISERFS_I(inode)->i_attrs = flags;
79 inode->i_ctime = CURRENT_TIME_SEC; 91 inode->i_ctime = CURRENT_TIME_SEC;
80 mark_inode_dirty(inode); 92 mark_inode_dirty(inode);
81 return 0; 93setflags_out:
94 mnt_drop_write(filp->f_path.mnt);
95 return err;
82 } 96 }
83 case REISERFS_IOC_GETVERSION: 97 case REISERFS_IOC_GETVERSION:
84 return put_user(inode->i_generation, (int __user *)arg); 98 return put_user(inode->i_generation, (int __user *)arg);
85 case REISERFS_IOC_SETVERSION: 99 case REISERFS_IOC_SETVERSION:
86 if (!is_owner_or_cap(inode)) 100 if (!is_owner_or_cap(inode))
87 return -EPERM; 101 return -EPERM;
88 if (IS_RDONLY(inode)) 102 err = mnt_want_write(filp->f_path.mnt);
89 return -EROFS; 103 if (err)
90 if (get_user(inode->i_generation, (int __user *)arg)) 104 return err;
91 return -EFAULT; 105 if (get_user(inode->i_generation, (int __user *)arg)) {
106 err = -EFAULT;
107 goto setversion_out;
108 }
92 inode->i_ctime = CURRENT_TIME_SEC; 109 inode->i_ctime = CURRENT_TIME_SEC;
93 mark_inode_dirty(inode); 110 mark_inode_dirty(inode);
94 return 0; 111setversion_out:
112 mnt_drop_write(filp->f_path.mnt);
113 return err;
95 default: 114 default:
96 return -ENOTTY; 115 return -ENOTTY;
97 } 116 }
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index bb05a3e51b93..060eb3f598e7 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -38,7 +38,7 @@
38#include <asm/system.h> 38#include <asm/system.h>
39 39
40#include <linux/time.h> 40#include <linux/time.h>
41#include <asm/semaphore.h> 41#include <linux/semaphore.h>
42 42
43#include <linux/vmalloc.h> 43#include <linux/vmalloc.h>
44#include <linux/reiserfs_fs.h> 44#include <linux/reiserfs_fs.h>
diff --git a/fs/reiserfs/lbalance.c b/fs/reiserfs/lbalance.c
index 281f8061ac58..6de060a6aa7f 100644
--- a/fs/reiserfs/lbalance.c
+++ b/fs/reiserfs/lbalance.c
@@ -626,7 +626,7 @@ static void leaf_define_dest_src_infos(int shift_mode, struct tree_balance *tb,
626 "vs-10250: leaf_define_dest_src_infos: shift type is unknown (%d)", 626 "vs-10250: leaf_define_dest_src_infos: shift type is unknown (%d)",
627 shift_mode); 627 shift_mode);
628 } 628 }
629 RFALSE(src_bi->bi_bh == 0 || dest_bi->bi_bh == 0, 629 RFALSE(!src_bi->bi_bh || !dest_bi->bi_bh,
630 "vs-10260: mode==%d, source (%p) or dest (%p) buffer is initialized incorrectly", 630 "vs-10260: mode==%d, source (%p) or dest (%p) buffer is initialized incorrectly",
631 shift_mode, src_bi->bi_bh, dest_bi->bi_bh); 631 shift_mode, src_bi->bi_bh, dest_bi->bi_bh);
632} 632}
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index b378eea332ca..8867533cb727 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -452,7 +452,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
452 buflen = DEH_SIZE + ROUND_UP(namelen); 452 buflen = DEH_SIZE + ROUND_UP(namelen);
453 if (buflen > sizeof(small_buf)) { 453 if (buflen > sizeof(small_buf)) {
454 buffer = kmalloc(buflen, GFP_NOFS); 454 buffer = kmalloc(buflen, GFP_NOFS);
455 if (buffer == 0) 455 if (!buffer)
456 return -ENOMEM; 456 return -ENOMEM;
457 } else 457 } else
458 buffer = small_buf; 458 buffer = small_buf;
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 6841452e0dea..393cc22c1717 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2031,7 +2031,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2031 return -EXDEV; 2031 return -EXDEV;
2032 } 2032 }
2033 /* We must not pack tails for quota files on reiserfs for quota IO to work */ 2033 /* We must not pack tails for quota files on reiserfs for quota IO to work */
2034 if (!REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask) { 2034 if (!(REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask)) {
2035 reiserfs_warning(sb, 2035 reiserfs_warning(sb,
2036 "reiserfs: Quota file must have tail packing disabled."); 2036 "reiserfs: Quota file must have tail packing disabled.");
2037 path_put(&nd.path); 2037 path_put(&nd.path);
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index eba037b3338f..d7c4935c1034 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -44,7 +44,6 @@
44#include <net/checksum.h> 44#include <net/checksum.h>
45#include <linux/smp_lock.h> 45#include <linux/smp_lock.h>
46#include <linux/stat.h> 46#include <linux/stat.h>
47#include <asm/semaphore.h>
48 47
49#define FL_READONLY 128 48#define FL_READONLY 128
50#define FL_DIR_SEM_HELD 256 49#define FL_DIR_SEM_HELD 256
@@ -191,28 +190,11 @@ static struct dentry *get_xa_file_dentry(const struct inode *inode,
191 dput(xadir); 190 dput(xadir);
192 if (err) 191 if (err)
193 xafile = ERR_PTR(err); 192 xafile = ERR_PTR(err);
194 return xafile;
195}
196
197/* Opens a file pointer to the attribute associated with inode */
198static struct file *open_xa_file(const struct inode *inode, const char *name,
199 int flags)
200{
201 struct dentry *xafile;
202 struct file *fp;
203
204 xafile = get_xa_file_dentry(inode, name, flags);
205 if (IS_ERR(xafile))
206 return ERR_PTR(PTR_ERR(xafile));
207 else if (!xafile->d_inode) { 193 else if (!xafile->d_inode) {
208 dput(xafile); 194 dput(xafile);
209 return ERR_PTR(-ENODATA); 195 xafile = ERR_PTR(-ENODATA);
210 } 196 }
211 197 return xafile;
212 fp = dentry_open(xafile, NULL, O_RDWR);
213 /* dentry_open dputs the dentry if it fails */
214
215 return fp;
216} 198}
217 199
218/* 200/*
@@ -228,9 +210,8 @@ static struct file *open_xa_file(const struct inode *inode, const char *name,
228 * we're called with i_mutex held, so there are no worries about the directory 210 * we're called with i_mutex held, so there are no worries about the directory
229 * changing underneath us. 211 * changing underneath us.
230 */ 212 */
231static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir) 213static int __xattr_readdir(struct inode *inode, void *dirent, filldir_t filldir)
232{ 214{
233 struct inode *inode = filp->f_path.dentry->d_inode;
234 struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */ 215 struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */
235 INITIALIZE_PATH(path_to_entry); 216 INITIALIZE_PATH(path_to_entry);
236 struct buffer_head *bh; 217 struct buffer_head *bh;
@@ -374,23 +355,16 @@ static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir)
374 * 355 *
375 */ 356 */
376static 357static
377int xattr_readdir(struct file *file, filldir_t filler, void *buf) 358int xattr_readdir(struct inode *inode, filldir_t filler, void *buf)
378{ 359{
379 struct inode *inode = file->f_path.dentry->d_inode; 360 int res = -ENOENT;
380 int res = -ENOTDIR;
381 if (!file->f_op || !file->f_op->readdir)
382 goto out;
383 mutex_lock_nested(&inode->i_mutex, I_MUTEX_XATTR); 361 mutex_lock_nested(&inode->i_mutex, I_MUTEX_XATTR);
384// down(&inode->i_zombie);
385 res = -ENOENT;
386 if (!IS_DEADDIR(inode)) { 362 if (!IS_DEADDIR(inode)) {
387 lock_kernel(); 363 lock_kernel();
388 res = __xattr_readdir(file, buf, filler); 364 res = __xattr_readdir(inode, buf, filler);
389 unlock_kernel(); 365 unlock_kernel();
390 } 366 }
391// up(&inode->i_zombie);
392 mutex_unlock(&inode->i_mutex); 367 mutex_unlock(&inode->i_mutex);
393 out:
394 return res; 368 return res;
395} 369}
396 370
@@ -442,7 +416,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
442 size_t buffer_size, int flags) 416 size_t buffer_size, int flags)
443{ 417{
444 int err = 0; 418 int err = 0;
445 struct file *fp; 419 struct dentry *dentry;
446 struct page *page; 420 struct page *page;
447 char *data; 421 char *data;
448 struct address_space *mapping; 422 struct address_space *mapping;
@@ -460,18 +434,18 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
460 xahash = xattr_hash(buffer, buffer_size); 434 xahash = xattr_hash(buffer, buffer_size);
461 435
462 open_file: 436 open_file:
463 fp = open_xa_file(inode, name, flags); 437 dentry = get_xa_file_dentry(inode, name, flags);
464 if (IS_ERR(fp)) { 438 if (IS_ERR(dentry)) {
465 err = PTR_ERR(fp); 439 err = PTR_ERR(dentry);
466 goto out; 440 goto out;
467 } 441 }
468 442
469 xinode = fp->f_path.dentry->d_inode; 443 xinode = dentry->d_inode;
470 REISERFS_I(inode)->i_flags |= i_has_xattr_dir; 444 REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
471 445
472 /* we need to copy it off.. */ 446 /* we need to copy it off.. */
473 if (xinode->i_nlink > 1) { 447 if (xinode->i_nlink > 1) {
474 fput(fp); 448 dput(dentry);
475 err = reiserfs_xattr_del(inode, name); 449 err = reiserfs_xattr_del(inode, name);
476 if (err < 0) 450 if (err < 0)
477 goto out; 451 goto out;
@@ -485,7 +459,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
485 newattrs.ia_size = buffer_size; 459 newattrs.ia_size = buffer_size;
486 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; 460 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
487 mutex_lock_nested(&xinode->i_mutex, I_MUTEX_XATTR); 461 mutex_lock_nested(&xinode->i_mutex, I_MUTEX_XATTR);
488 err = notify_change(fp->f_path.dentry, &newattrs); 462 err = notify_change(dentry, &newattrs);
489 if (err) 463 if (err)
490 goto out_filp; 464 goto out_filp;
491 465
@@ -518,15 +492,14 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
518 rxh->h_hash = cpu_to_le32(xahash); 492 rxh->h_hash = cpu_to_le32(xahash);
519 } 493 }
520 494
521 err = reiserfs_prepare_write(fp, page, page_offset, 495 err = reiserfs_prepare_write(NULL, page, page_offset,
522 page_offset + chunk + skip); 496 page_offset + chunk + skip);
523 if (!err) { 497 if (!err) {
524 if (buffer) 498 if (buffer)
525 memcpy(data + skip, buffer + buffer_pos, chunk); 499 memcpy(data + skip, buffer + buffer_pos, chunk);
526 err = 500 err = reiserfs_commit_write(NULL, page, page_offset,
527 reiserfs_commit_write(fp, page, page_offset, 501 page_offset + chunk +
528 page_offset + chunk + 502 skip);
529 skip);
530 } 503 }
531 unlock_page(page); 504 unlock_page(page);
532 reiserfs_put_page(page); 505 reiserfs_put_page(page);
@@ -548,7 +521,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
548 521
549 out_filp: 522 out_filp:
550 mutex_unlock(&xinode->i_mutex); 523 mutex_unlock(&xinode->i_mutex);
551 fput(fp); 524 dput(dentry);
552 525
553 out: 526 out:
554 return err; 527 return err;
@@ -562,7 +535,7 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
562 size_t buffer_size) 535 size_t buffer_size)
563{ 536{
564 ssize_t err = 0; 537 ssize_t err = 0;
565 struct file *fp; 538 struct dentry *dentry;
566 size_t isize; 539 size_t isize;
567 size_t file_pos = 0; 540 size_t file_pos = 0;
568 size_t buffer_pos = 0; 541 size_t buffer_pos = 0;
@@ -578,13 +551,13 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
578 if (get_inode_sd_version(inode) == STAT_DATA_V1) 551 if (get_inode_sd_version(inode) == STAT_DATA_V1)
579 return -EOPNOTSUPP; 552 return -EOPNOTSUPP;
580 553
581 fp = open_xa_file(inode, name, FL_READONLY); 554 dentry = get_xa_file_dentry(inode, name, FL_READONLY);
582 if (IS_ERR(fp)) { 555 if (IS_ERR(dentry)) {
583 err = PTR_ERR(fp); 556 err = PTR_ERR(dentry);
584 goto out; 557 goto out;
585 } 558 }
586 559
587 xinode = fp->f_path.dentry->d_inode; 560 xinode = dentry->d_inode;
588 isize = xinode->i_size; 561 isize = xinode->i_size;
589 REISERFS_I(inode)->i_flags |= i_has_xattr_dir; 562 REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
590 563
@@ -652,7 +625,7 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
652 } 625 }
653 626
654 out_dput: 627 out_dput:
655 fput(fp); 628 dput(dentry);
656 629
657 out: 630 out:
658 return err; 631 return err;
@@ -742,7 +715,6 @@ reiserfs_delete_xattrs_filler(void *buf, const char *name, int namelen,
742/* This is called w/ inode->i_mutex downed */ 715/* This is called w/ inode->i_mutex downed */
743int reiserfs_delete_xattrs(struct inode *inode) 716int reiserfs_delete_xattrs(struct inode *inode)
744{ 717{
745 struct file *fp;
746 struct dentry *dir, *root; 718 struct dentry *dir, *root;
747 int err = 0; 719 int err = 0;
748 720
@@ -763,15 +735,8 @@ int reiserfs_delete_xattrs(struct inode *inode)
763 return 0; 735 return 0;
764 } 736 }
765 737
766 fp = dentry_open(dir, NULL, O_RDWR);
767 if (IS_ERR(fp)) {
768 err = PTR_ERR(fp);
769 /* dentry_open dputs the dentry if it fails */
770 goto out;
771 }
772
773 lock_kernel(); 738 lock_kernel();
774 err = xattr_readdir(fp, reiserfs_delete_xattrs_filler, dir); 739 err = xattr_readdir(dir->d_inode, reiserfs_delete_xattrs_filler, dir);
775 if (err) { 740 if (err) {
776 unlock_kernel(); 741 unlock_kernel();
777 goto out_dir; 742 goto out_dir;
@@ -791,7 +756,7 @@ int reiserfs_delete_xattrs(struct inode *inode)
791 unlock_kernel(); 756 unlock_kernel();
792 757
793 out_dir: 758 out_dir:
794 fput(fp); 759 dput(dir);
795 760
796 out: 761 out:
797 if (!err) 762 if (!err)
@@ -833,7 +798,6 @@ reiserfs_chown_xattrs_filler(void *buf, const char *name, int namelen,
833 798
834int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs) 799int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
835{ 800{
836 struct file *fp;
837 struct dentry *dir; 801 struct dentry *dir;
838 int err = 0; 802 int err = 0;
839 struct reiserfs_chown_buf buf; 803 struct reiserfs_chown_buf buf;
@@ -857,13 +821,6 @@ int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
857 goto out; 821 goto out;
858 } 822 }
859 823
860 fp = dentry_open(dir, NULL, O_RDWR);
861 if (IS_ERR(fp)) {
862 err = PTR_ERR(fp);
863 /* dentry_open dputs the dentry if it fails */
864 goto out;
865 }
866
867 lock_kernel(); 824 lock_kernel();
868 825
869 attrs->ia_valid &= (ATTR_UID | ATTR_GID | ATTR_CTIME); 826 attrs->ia_valid &= (ATTR_UID | ATTR_GID | ATTR_CTIME);
@@ -871,7 +828,7 @@ int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
871 buf.attrs = attrs; 828 buf.attrs = attrs;
872 buf.inode = inode; 829 buf.inode = inode;
873 830
874 err = xattr_readdir(fp, reiserfs_chown_xattrs_filler, &buf); 831 err = xattr_readdir(dir->d_inode, reiserfs_chown_xattrs_filler, &buf);
875 if (err) { 832 if (err) {
876 unlock_kernel(); 833 unlock_kernel();
877 goto out_dir; 834 goto out_dir;
@@ -881,7 +838,7 @@ int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
881 unlock_kernel(); 838 unlock_kernel();
882 839
883 out_dir: 840 out_dir:
884 fput(fp); 841 dput(dir);
885 842
886 out: 843 out:
887 attrs->ia_valid = ia_valid; 844 attrs->ia_valid = ia_valid;
@@ -1029,7 +986,6 @@ reiserfs_listxattr_filler(void *buf, const char *name, int namelen,
1029 */ 986 */
1030ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) 987ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
1031{ 988{
1032 struct file *fp;
1033 struct dentry *dir; 989 struct dentry *dir;
1034 int err = 0; 990 int err = 0;
1035 struct reiserfs_listxattr_buf buf; 991 struct reiserfs_listxattr_buf buf;
@@ -1052,13 +1008,6 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
1052 goto out; 1008 goto out;
1053 } 1009 }
1054 1010
1055 fp = dentry_open(dir, NULL, O_RDWR);
1056 if (IS_ERR(fp)) {
1057 err = PTR_ERR(fp);
1058 /* dentry_open dputs the dentry if it fails */
1059 goto out;
1060 }
1061
1062 buf.r_buf = buffer; 1011 buf.r_buf = buffer;
1063 buf.r_size = buffer ? size : 0; 1012 buf.r_size = buffer ? size : 0;
1064 buf.r_pos = 0; 1013 buf.r_pos = 0;
@@ -1066,7 +1015,7 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
1066 1015
1067 REISERFS_I(dentry->d_inode)->i_flags |= i_has_xattr_dir; 1016 REISERFS_I(dentry->d_inode)->i_flags |= i_has_xattr_dir;
1068 1017
1069 err = xattr_readdir(fp, reiserfs_listxattr_filler, &buf); 1018 err = xattr_readdir(dir->d_inode, reiserfs_listxattr_filler, &buf);
1070 if (err) 1019 if (err)
1071 goto out_dir; 1020 goto out_dir;
1072 1021
@@ -1076,7 +1025,7 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
1076 err = buf.r_pos; 1025 err = buf.r_pos;
1077 1026
1078 out_dir: 1027 out_dir:
1079 fput(fp); 1028 dput(dir);
1080 1029
1081 out: 1030 out:
1082 reiserfs_read_unlock_xattr_i(dentry->d_inode); 1031 reiserfs_read_unlock_xattr_i(dentry->d_inode);