diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2008-04-01 00:22:26 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2008-04-01 00:22:26 -0400 |
commit | 399f486286f44d55c4fff0e9cc5d712f2b443489 (patch) | |
tree | 0c2820b3e04232eaa96f08c1057b87728fb3e7a4 /fs/reiserfs | |
parent | 481419ec9fbdf3f4ec5389c7e91a81b4a7ebee8d (diff) | |
parent | a9edadbf790d72adf6ebed476cb5caf7743e7e4a (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-linus
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/do_balan.c | 8 | ||||
-rw-r--r-- | fs/reiserfs/fix_node.c | 8 | ||||
-rw-r--r-- | fs/reiserfs/lbalance.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/namei.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/xattr.c | 110 |
5 files changed, 41 insertions, 89 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/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/xattr.c b/fs/reiserfs/xattr.c index eba037b3338f..344b9b96cc56 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -191,28 +191,11 @@ static struct dentry *get_xa_file_dentry(const struct inode *inode, | |||
191 | dput(xadir); | 191 | dput(xadir); |
192 | if (err) | 192 | if (err) |
193 | xafile = ERR_PTR(err); | 193 | xafile = ERR_PTR(err); |
194 | return xafile; | ||
195 | } | ||
196 | |||
197 | /* Opens a file pointer to the attribute associated with inode */ | ||
198 | static 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) { | 194 | else if (!xafile->d_inode) { |
208 | dput(xafile); | 195 | dput(xafile); |
209 | return ERR_PTR(-ENODATA); | 196 | xafile = ERR_PTR(-ENODATA); |
210 | } | 197 | } |
211 | 198 | return xafile; | |
212 | fp = dentry_open(xafile, NULL, O_RDWR); | ||
213 | /* dentry_open dputs the dentry if it fails */ | ||
214 | |||
215 | return fp; | ||
216 | } | 199 | } |
217 | 200 | ||
218 | /* | 201 | /* |
@@ -228,9 +211,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 | 211 | * we're called with i_mutex held, so there are no worries about the directory |
229 | * changing underneath us. | 212 | * changing underneath us. |
230 | */ | 213 | */ |
231 | static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir) | 214 | static int __xattr_readdir(struct inode *inode, void *dirent, filldir_t filldir) |
232 | { | 215 | { |
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) */ | 216 | struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */ |
235 | INITIALIZE_PATH(path_to_entry); | 217 | INITIALIZE_PATH(path_to_entry); |
236 | struct buffer_head *bh; | 218 | struct buffer_head *bh; |
@@ -374,23 +356,16 @@ static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
374 | * | 356 | * |
375 | */ | 357 | */ |
376 | static | 358 | static |
377 | int xattr_readdir(struct file *file, filldir_t filler, void *buf) | 359 | int xattr_readdir(struct inode *inode, filldir_t filler, void *buf) |
378 | { | 360 | { |
379 | struct inode *inode = file->f_path.dentry->d_inode; | 361 | 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); | 362 | mutex_lock_nested(&inode->i_mutex, I_MUTEX_XATTR); |
384 | // down(&inode->i_zombie); | ||
385 | res = -ENOENT; | ||
386 | if (!IS_DEADDIR(inode)) { | 363 | if (!IS_DEADDIR(inode)) { |
387 | lock_kernel(); | 364 | lock_kernel(); |
388 | res = __xattr_readdir(file, buf, filler); | 365 | res = __xattr_readdir(inode, buf, filler); |
389 | unlock_kernel(); | 366 | unlock_kernel(); |
390 | } | 367 | } |
391 | // up(&inode->i_zombie); | ||
392 | mutex_unlock(&inode->i_mutex); | 368 | mutex_unlock(&inode->i_mutex); |
393 | out: | ||
394 | return res; | 369 | return res; |
395 | } | 370 | } |
396 | 371 | ||
@@ -442,7 +417,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer, | |||
442 | size_t buffer_size, int flags) | 417 | size_t buffer_size, int flags) |
443 | { | 418 | { |
444 | int err = 0; | 419 | int err = 0; |
445 | struct file *fp; | 420 | struct dentry *dentry; |
446 | struct page *page; | 421 | struct page *page; |
447 | char *data; | 422 | char *data; |
448 | struct address_space *mapping; | 423 | struct address_space *mapping; |
@@ -460,18 +435,18 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer, | |||
460 | xahash = xattr_hash(buffer, buffer_size); | 435 | xahash = xattr_hash(buffer, buffer_size); |
461 | 436 | ||
462 | open_file: | 437 | open_file: |
463 | fp = open_xa_file(inode, name, flags); | 438 | dentry = get_xa_file_dentry(inode, name, flags); |
464 | if (IS_ERR(fp)) { | 439 | if (IS_ERR(dentry)) { |
465 | err = PTR_ERR(fp); | 440 | err = PTR_ERR(dentry); |
466 | goto out; | 441 | goto out; |
467 | } | 442 | } |
468 | 443 | ||
469 | xinode = fp->f_path.dentry->d_inode; | 444 | xinode = dentry->d_inode; |
470 | REISERFS_I(inode)->i_flags |= i_has_xattr_dir; | 445 | REISERFS_I(inode)->i_flags |= i_has_xattr_dir; |
471 | 446 | ||
472 | /* we need to copy it off.. */ | 447 | /* we need to copy it off.. */ |
473 | if (xinode->i_nlink > 1) { | 448 | if (xinode->i_nlink > 1) { |
474 | fput(fp); | 449 | dput(dentry); |
475 | err = reiserfs_xattr_del(inode, name); | 450 | err = reiserfs_xattr_del(inode, name); |
476 | if (err < 0) | 451 | if (err < 0) |
477 | goto out; | 452 | goto out; |
@@ -485,7 +460,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer, | |||
485 | newattrs.ia_size = buffer_size; | 460 | newattrs.ia_size = buffer_size; |
486 | newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; | 461 | newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; |
487 | mutex_lock_nested(&xinode->i_mutex, I_MUTEX_XATTR); | 462 | mutex_lock_nested(&xinode->i_mutex, I_MUTEX_XATTR); |
488 | err = notify_change(fp->f_path.dentry, &newattrs); | 463 | err = notify_change(dentry, &newattrs); |
489 | if (err) | 464 | if (err) |
490 | goto out_filp; | 465 | goto out_filp; |
491 | 466 | ||
@@ -518,15 +493,14 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer, | |||
518 | rxh->h_hash = cpu_to_le32(xahash); | 493 | rxh->h_hash = cpu_to_le32(xahash); |
519 | } | 494 | } |
520 | 495 | ||
521 | err = reiserfs_prepare_write(fp, page, page_offset, | 496 | err = reiserfs_prepare_write(NULL, page, page_offset, |
522 | page_offset + chunk + skip); | 497 | page_offset + chunk + skip); |
523 | if (!err) { | 498 | if (!err) { |
524 | if (buffer) | 499 | if (buffer) |
525 | memcpy(data + skip, buffer + buffer_pos, chunk); | 500 | memcpy(data + skip, buffer + buffer_pos, chunk); |
526 | err = | 501 | err = reiserfs_commit_write(NULL, page, page_offset, |
527 | reiserfs_commit_write(fp, page, page_offset, | 502 | page_offset + chunk + |
528 | page_offset + chunk + | 503 | skip); |
529 | skip); | ||
530 | } | 504 | } |
531 | unlock_page(page); | 505 | unlock_page(page); |
532 | reiserfs_put_page(page); | 506 | reiserfs_put_page(page); |
@@ -548,7 +522,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer, | |||
548 | 522 | ||
549 | out_filp: | 523 | out_filp: |
550 | mutex_unlock(&xinode->i_mutex); | 524 | mutex_unlock(&xinode->i_mutex); |
551 | fput(fp); | 525 | dput(dentry); |
552 | 526 | ||
553 | out: | 527 | out: |
554 | return err; | 528 | return err; |
@@ -562,7 +536,7 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer, | |||
562 | size_t buffer_size) | 536 | size_t buffer_size) |
563 | { | 537 | { |
564 | ssize_t err = 0; | 538 | ssize_t err = 0; |
565 | struct file *fp; | 539 | struct dentry *dentry; |
566 | size_t isize; | 540 | size_t isize; |
567 | size_t file_pos = 0; | 541 | size_t file_pos = 0; |
568 | size_t buffer_pos = 0; | 542 | size_t buffer_pos = 0; |
@@ -578,13 +552,13 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer, | |||
578 | if (get_inode_sd_version(inode) == STAT_DATA_V1) | 552 | if (get_inode_sd_version(inode) == STAT_DATA_V1) |
579 | return -EOPNOTSUPP; | 553 | return -EOPNOTSUPP; |
580 | 554 | ||
581 | fp = open_xa_file(inode, name, FL_READONLY); | 555 | dentry = get_xa_file_dentry(inode, name, FL_READONLY); |
582 | if (IS_ERR(fp)) { | 556 | if (IS_ERR(dentry)) { |
583 | err = PTR_ERR(fp); | 557 | err = PTR_ERR(dentry); |
584 | goto out; | 558 | goto out; |
585 | } | 559 | } |
586 | 560 | ||
587 | xinode = fp->f_path.dentry->d_inode; | 561 | xinode = dentry->d_inode; |
588 | isize = xinode->i_size; | 562 | isize = xinode->i_size; |
589 | REISERFS_I(inode)->i_flags |= i_has_xattr_dir; | 563 | REISERFS_I(inode)->i_flags |= i_has_xattr_dir; |
590 | 564 | ||
@@ -652,7 +626,7 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer, | |||
652 | } | 626 | } |
653 | 627 | ||
654 | out_dput: | 628 | out_dput: |
655 | fput(fp); | 629 | dput(dentry); |
656 | 630 | ||
657 | out: | 631 | out: |
658 | return err; | 632 | return err; |
@@ -742,7 +716,6 @@ reiserfs_delete_xattrs_filler(void *buf, const char *name, int namelen, | |||
742 | /* This is called w/ inode->i_mutex downed */ | 716 | /* This is called w/ inode->i_mutex downed */ |
743 | int reiserfs_delete_xattrs(struct inode *inode) | 717 | int reiserfs_delete_xattrs(struct inode *inode) |
744 | { | 718 | { |
745 | struct file *fp; | ||
746 | struct dentry *dir, *root; | 719 | struct dentry *dir, *root; |
747 | int err = 0; | 720 | int err = 0; |
748 | 721 | ||
@@ -763,15 +736,8 @@ int reiserfs_delete_xattrs(struct inode *inode) | |||
763 | return 0; | 736 | return 0; |
764 | } | 737 | } |
765 | 738 | ||
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(); | 739 | lock_kernel(); |
774 | err = xattr_readdir(fp, reiserfs_delete_xattrs_filler, dir); | 740 | err = xattr_readdir(dir->d_inode, reiserfs_delete_xattrs_filler, dir); |
775 | if (err) { | 741 | if (err) { |
776 | unlock_kernel(); | 742 | unlock_kernel(); |
777 | goto out_dir; | 743 | goto out_dir; |
@@ -791,7 +757,7 @@ int reiserfs_delete_xattrs(struct inode *inode) | |||
791 | unlock_kernel(); | 757 | unlock_kernel(); |
792 | 758 | ||
793 | out_dir: | 759 | out_dir: |
794 | fput(fp); | 760 | dput(dir); |
795 | 761 | ||
796 | out: | 762 | out: |
797 | if (!err) | 763 | if (!err) |
@@ -833,7 +799,6 @@ reiserfs_chown_xattrs_filler(void *buf, const char *name, int namelen, | |||
833 | 799 | ||
834 | int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs) | 800 | int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs) |
835 | { | 801 | { |
836 | struct file *fp; | ||
837 | struct dentry *dir; | 802 | struct dentry *dir; |
838 | int err = 0; | 803 | int err = 0; |
839 | struct reiserfs_chown_buf buf; | 804 | struct reiserfs_chown_buf buf; |
@@ -857,13 +822,6 @@ int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs) | |||
857 | goto out; | 822 | goto out; |
858 | } | 823 | } |
859 | 824 | ||
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(); | 825 | lock_kernel(); |
868 | 826 | ||
869 | attrs->ia_valid &= (ATTR_UID | ATTR_GID | ATTR_CTIME); | 827 | attrs->ia_valid &= (ATTR_UID | ATTR_GID | ATTR_CTIME); |
@@ -871,7 +829,7 @@ int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs) | |||
871 | buf.attrs = attrs; | 829 | buf.attrs = attrs; |
872 | buf.inode = inode; | 830 | buf.inode = inode; |
873 | 831 | ||
874 | err = xattr_readdir(fp, reiserfs_chown_xattrs_filler, &buf); | 832 | err = xattr_readdir(dir->d_inode, reiserfs_chown_xattrs_filler, &buf); |
875 | if (err) { | 833 | if (err) { |
876 | unlock_kernel(); | 834 | unlock_kernel(); |
877 | goto out_dir; | 835 | goto out_dir; |
@@ -881,7 +839,7 @@ int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs) | |||
881 | unlock_kernel(); | 839 | unlock_kernel(); |
882 | 840 | ||
883 | out_dir: | 841 | out_dir: |
884 | fput(fp); | 842 | dput(dir); |
885 | 843 | ||
886 | out: | 844 | out: |
887 | attrs->ia_valid = ia_valid; | 845 | attrs->ia_valid = ia_valid; |
@@ -1029,7 +987,6 @@ reiserfs_listxattr_filler(void *buf, const char *name, int namelen, | |||
1029 | */ | 987 | */ |
1030 | ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) | 988 | ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) |
1031 | { | 989 | { |
1032 | struct file *fp; | ||
1033 | struct dentry *dir; | 990 | struct dentry *dir; |
1034 | int err = 0; | 991 | int err = 0; |
1035 | struct reiserfs_listxattr_buf buf; | 992 | struct reiserfs_listxattr_buf buf; |
@@ -1052,13 +1009,6 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) | |||
1052 | goto out; | 1009 | goto out; |
1053 | } | 1010 | } |
1054 | 1011 | ||
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; | 1012 | buf.r_buf = buffer; |
1063 | buf.r_size = buffer ? size : 0; | 1013 | buf.r_size = buffer ? size : 0; |
1064 | buf.r_pos = 0; | 1014 | buf.r_pos = 0; |
@@ -1066,7 +1016,7 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) | |||
1066 | 1016 | ||
1067 | REISERFS_I(dentry->d_inode)->i_flags |= i_has_xattr_dir; | 1017 | REISERFS_I(dentry->d_inode)->i_flags |= i_has_xattr_dir; |
1068 | 1018 | ||
1069 | err = xattr_readdir(fp, reiserfs_listxattr_filler, &buf); | 1019 | err = xattr_readdir(dir->d_inode, reiserfs_listxattr_filler, &buf); |
1070 | if (err) | 1020 | if (err) |
1071 | goto out_dir; | 1021 | goto out_dir; |
1072 | 1022 | ||
@@ -1076,7 +1026,7 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) | |||
1076 | err = buf.r_pos; | 1026 | err = buf.r_pos; |
1077 | 1027 | ||
1078 | out_dir: | 1028 | out_dir: |
1079 | fput(fp); | 1029 | dput(dir); |
1080 | 1030 | ||
1081 | out: | 1031 | out: |
1082 | reiserfs_read_unlock_xattr_i(dentry->d_inode); | 1032 | reiserfs_read_unlock_xattr_i(dentry->d_inode); |