aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs/namei.c')
-rw-r--r--fs/reiserfs/namei.c180
1 files changed, 84 insertions, 96 deletions
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 639d635d9d4b..efd4d720718e 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -106,7 +106,7 @@ key of the first directory entry in it.
106This function first calls search_by_key, then, if item whose first 106This function first calls search_by_key, then, if item whose first
107entry matches is not found it looks for the entry inside directory 107entry matches is not found it looks for the entry inside directory
108item found by search_by_key. Fills the path to the entry, and to the 108item found by search_by_key. Fills the path to the entry, and to the
109entry position in the item 109entry position in the item
110 110
111*/ 111*/
112 112
@@ -120,8 +120,8 @@ int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
120 switch (retval) { 120 switch (retval) {
121 case ITEM_NOT_FOUND: 121 case ITEM_NOT_FOUND:
122 if (!PATH_LAST_POSITION(path)) { 122 if (!PATH_LAST_POSITION(path)) {
123 reiserfs_warning(sb, 123 reiserfs_error(sb, "vs-7000", "search_by_key "
124 "vs-7000: search_by_entry_key: search_by_key returned item position == 0"); 124 "returned item position == 0");
125 pathrelse(path); 125 pathrelse(path);
126 return IO_ERROR; 126 return IO_ERROR;
127 } 127 }
@@ -135,8 +135,7 @@ int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
135 135
136 default: 136 default:
137 pathrelse(path); 137 pathrelse(path);
138 reiserfs_warning(sb, 138 reiserfs_error(sb, "vs-7002", "no path to here");
139 "vs-7002: search_by_entry_key: no path to here");
140 return IO_ERROR; 139 return IO_ERROR;
141 } 140 }
142 141
@@ -146,10 +145,9 @@ int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
146 if (!is_direntry_le_ih(de->de_ih) || 145 if (!is_direntry_le_ih(de->de_ih) ||
147 COMP_SHORT_KEYS(&(de->de_ih->ih_key), key)) { 146 COMP_SHORT_KEYS(&(de->de_ih->ih_key), key)) {
148 print_block(de->de_bh, 0, -1, -1); 147 print_block(de->de_bh, 0, -1, -1);
149 reiserfs_panic(sb, 148 reiserfs_panic(sb, "vs-7005", "found item %h is not directory "
150 "vs-7005: search_by_entry_key: found item %h is not directory item or " 149 "item or does not belong to the same directory "
151 "does not belong to the same directory as key %K", 150 "as key %K", de->de_ih, key);
152 de->de_ih, key);
153 } 151 }
154#endif /* CONFIG_REISERFS_CHECK */ 152#endif /* CONFIG_REISERFS_CHECK */
155 153
@@ -300,8 +298,7 @@ static int reiserfs_find_entry(struct inode *dir, const char *name, int namelen,
300 search_by_entry_key(dir->i_sb, &key_to_search, 298 search_by_entry_key(dir->i_sb, &key_to_search,
301 path_to_entry, de); 299 path_to_entry, de);
302 if (retval == IO_ERROR) { 300 if (retval == IO_ERROR) {
303 reiserfs_warning(dir->i_sb, "zam-7001: io error in %s", 301 reiserfs_error(dir->i_sb, "zam-7001", "io error");
304 __func__);
305 return IO_ERROR; 302 return IO_ERROR;
306 } 303 }
307 304
@@ -361,9 +358,10 @@ static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry,
361 return ERR_PTR(-EACCES); 358 return ERR_PTR(-EACCES);
362 } 359 }
363 360
364 /* Propogate the priv_object flag so we know we're in the priv tree */ 361 /* Propagate the private flag so we know we're
365 if (is_reiserfs_priv_object(dir)) 362 * in the priv tree */
366 reiserfs_mark_inode_private(inode); 363 if (IS_PRIVATE(dir))
364 inode->i_flags |= S_PRIVATE;
367 } 365 }
368 reiserfs_write_unlock(dir->i_sb); 366 reiserfs_write_unlock(dir->i_sb);
369 if (retval == IO_ERROR) { 367 if (retval == IO_ERROR) {
@@ -373,7 +371,7 @@ static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry,
373 return d_splice_alias(inode, dentry); 371 return d_splice_alias(inode, dentry);
374} 372}
375 373
376/* 374/*
377** looks up the dentry of the parent directory for child. 375** looks up the dentry of the parent directory for child.
378** taken from ext2_get_parent 376** taken from ext2_get_parent
379*/ 377*/
@@ -403,7 +401,7 @@ struct dentry *reiserfs_get_parent(struct dentry *child)
403 return d_obtain_alias(inode); 401 return d_obtain_alias(inode);
404} 402}
405 403
406/* add entry to the directory (entry can be hidden). 404/* add entry to the directory (entry can be hidden).
407 405
408insert definition of when hidden directories are used here -Hans 406insert definition of when hidden directories are used here -Hans
409 407
@@ -484,10 +482,9 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
484 } 482 }
485 483
486 if (retval != NAME_FOUND) { 484 if (retval != NAME_FOUND) {
487 reiserfs_warning(dir->i_sb, 485 reiserfs_error(dir->i_sb, "zam-7002",
488 "zam-7002:%s: \"reiserfs_find_entry\" " 486 "reiserfs_find_entry() returned "
489 "has returned unexpected value (%d)", 487 "unexpected value (%d)", retval);
490 __func__, retval);
491 } 488 }
492 489
493 return -EEXIST; 490 return -EEXIST;
@@ -498,8 +495,9 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
498 MAX_GENERATION_NUMBER + 1); 495 MAX_GENERATION_NUMBER + 1);
499 if (gen_number > MAX_GENERATION_NUMBER) { 496 if (gen_number > MAX_GENERATION_NUMBER) {
500 /* there is no free generation number */ 497 /* there is no free generation number */
501 reiserfs_warning(dir->i_sb, 498 reiserfs_warning(dir->i_sb, "reiserfs-7010",
502 "reiserfs_add_entry: Congratulations! we have got hash function screwed up"); 499 "Congratulations! we have got hash function "
500 "screwed up");
503 if (buffer != small_buf) 501 if (buffer != small_buf)
504 kfree(buffer); 502 kfree(buffer);
505 pathrelse(&path); 503 pathrelse(&path);
@@ -515,10 +513,9 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
515 if (gen_number != 0) { /* we need to re-search for the insertion point */ 513 if (gen_number != 0) { /* we need to re-search for the insertion point */
516 if (search_by_entry_key(dir->i_sb, &entry_key, &path, &de) != 514 if (search_by_entry_key(dir->i_sb, &entry_key, &path, &de) !=
517 NAME_NOT_FOUND) { 515 NAME_NOT_FOUND) {
518 reiserfs_warning(dir->i_sb, 516 reiserfs_warning(dir->i_sb, "vs-7032",
519 "vs-7032: reiserfs_add_entry: " 517 "entry with this key (%K) already "
520 "entry with this key (%K) already exists", 518 "exists", &entry_key);
521 &entry_key);
522 519
523 if (buffer != small_buf) 520 if (buffer != small_buf)
524 kfree(buffer); 521 kfree(buffer);
@@ -562,7 +559,7 @@ static int drop_new_inode(struct inode *inode)
562 return 0; 559 return 0;
563} 560}
564 561
565/* utility function that does setup for reiserfs_new_inode. 562/* utility function that does setup for reiserfs_new_inode.
566** vfs_dq_init needs lots of credits so it's better to have it 563** vfs_dq_init needs lots of credits so it's better to have it
567** outside of a transaction, so we had to pull some bits of 564** outside of a transaction, so we had to pull some bits of
568** reiserfs_new_inode out into this func. 565** reiserfs_new_inode out into this func.
@@ -601,20 +598,22 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, int mode,
601 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + 598 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
602 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); 599 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
603 struct reiserfs_transaction_handle th; 600 struct reiserfs_transaction_handle th;
604 int locked; 601 struct reiserfs_security_handle security;
605 602
606 if (!(inode = new_inode(dir->i_sb))) { 603 if (!(inode = new_inode(dir->i_sb))) {
607 return -ENOMEM; 604 return -ENOMEM;
608 } 605 }
609 new_inode_init(inode, dir, mode); 606 new_inode_init(inode, dir, mode);
610 607
611 locked = reiserfs_cache_default_acl(dir); 608 jbegin_count += reiserfs_cache_default_acl(dir);
612 609 retval = reiserfs_security_init(dir, inode, &security);
610 if (retval < 0) {
611 drop_new_inode(inode);
612 return retval;
613 }
614 jbegin_count += retval;
613 reiserfs_write_lock(dir->i_sb); 615 reiserfs_write_lock(dir->i_sb);
614 616
615 if (locked)
616 reiserfs_write_lock_xattrs(dir->i_sb);
617
618 retval = journal_begin(&th, dir->i_sb, jbegin_count); 617 retval = journal_begin(&th, dir->i_sb, jbegin_count);
619 if (retval) { 618 if (retval) {
620 drop_new_inode(inode); 619 drop_new_inode(inode);
@@ -623,15 +622,10 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, int mode,
623 622
624 retval = 623 retval =
625 reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry, 624 reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry,
626 inode); 625 inode, &security);
627 if (retval) 626 if (retval)
628 goto out_failed; 627 goto out_failed;
629 628
630 if (locked) {
631 reiserfs_write_unlock_xattrs(dir->i_sb);
632 locked = 0;
633 }
634
635 inode->i_op = &reiserfs_file_inode_operations; 629 inode->i_op = &reiserfs_file_inode_operations;
636 inode->i_fop = &reiserfs_file_operations; 630 inode->i_fop = &reiserfs_file_operations;
637 inode->i_mapping->a_ops = &reiserfs_address_space_operations; 631 inode->i_mapping->a_ops = &reiserfs_address_space_operations;
@@ -658,8 +652,6 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, int mode,
658 retval = journal_end(&th, dir->i_sb, jbegin_count); 652 retval = journal_end(&th, dir->i_sb, jbegin_count);
659 653
660 out_failed: 654 out_failed:
661 if (locked)
662 reiserfs_write_unlock_xattrs(dir->i_sb);
663 reiserfs_write_unlock(dir->i_sb); 655 reiserfs_write_unlock(dir->i_sb);
664 return retval; 656 return retval;
665} 657}
@@ -670,12 +662,12 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
670 int retval; 662 int retval;
671 struct inode *inode; 663 struct inode *inode;
672 struct reiserfs_transaction_handle th; 664 struct reiserfs_transaction_handle th;
665 struct reiserfs_security_handle security;
673 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */ 666 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
674 int jbegin_count = 667 int jbegin_count =
675 JOURNAL_PER_BALANCE_CNT * 3 + 668 JOURNAL_PER_BALANCE_CNT * 3 +
676 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + 669 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
677 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); 670 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
678 int locked;
679 671
680 if (!new_valid_dev(rdev)) 672 if (!new_valid_dev(rdev))
681 return -EINVAL; 673 return -EINVAL;
@@ -685,13 +677,15 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
685 } 677 }
686 new_inode_init(inode, dir, mode); 678 new_inode_init(inode, dir, mode);
687 679
688 locked = reiserfs_cache_default_acl(dir); 680 jbegin_count += reiserfs_cache_default_acl(dir);
689 681 retval = reiserfs_security_init(dir, inode, &security);
682 if (retval < 0) {
683 drop_new_inode(inode);
684 return retval;
685 }
686 jbegin_count += retval;
690 reiserfs_write_lock(dir->i_sb); 687 reiserfs_write_lock(dir->i_sb);
691 688
692 if (locked)
693 reiserfs_write_lock_xattrs(dir->i_sb);
694
695 retval = journal_begin(&th, dir->i_sb, jbegin_count); 689 retval = journal_begin(&th, dir->i_sb, jbegin_count);
696 if (retval) { 690 if (retval) {
697 drop_new_inode(inode); 691 drop_new_inode(inode);
@@ -700,16 +694,11 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
700 694
701 retval = 695 retval =
702 reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry, 696 reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry,
703 inode); 697 inode, &security);
704 if (retval) { 698 if (retval) {
705 goto out_failed; 699 goto out_failed;
706 } 700 }
707 701
708 if (locked) {
709 reiserfs_write_unlock_xattrs(dir->i_sb);
710 locked = 0;
711 }
712
713 inode->i_op = &reiserfs_special_inode_operations; 702 inode->i_op = &reiserfs_special_inode_operations;
714 init_special_inode(inode, inode->i_mode, rdev); 703 init_special_inode(inode, inode->i_mode, rdev);
715 704
@@ -739,8 +728,6 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
739 retval = journal_end(&th, dir->i_sb, jbegin_count); 728 retval = journal_end(&th, dir->i_sb, jbegin_count);
740 729
741 out_failed: 730 out_failed:
742 if (locked)
743 reiserfs_write_unlock_xattrs(dir->i_sb);
744 reiserfs_write_unlock(dir->i_sb); 731 reiserfs_write_unlock(dir->i_sb);
745 return retval; 732 return retval;
746} 733}
@@ -750,12 +737,12 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
750 int retval; 737 int retval;
751 struct inode *inode; 738 struct inode *inode;
752 struct reiserfs_transaction_handle th; 739 struct reiserfs_transaction_handle th;
740 struct reiserfs_security_handle security;
753 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */ 741 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
754 int jbegin_count = 742 int jbegin_count =
755 JOURNAL_PER_BALANCE_CNT * 3 + 743 JOURNAL_PER_BALANCE_CNT * 3 +
756 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + 744 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
757 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); 745 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
758 int locked;
759 746
760#ifdef DISPLACE_NEW_PACKING_LOCALITIES 747#ifdef DISPLACE_NEW_PACKING_LOCALITIES
761 /* set flag that new packing locality created and new blocks for the content * of that directory are not displaced yet */ 748 /* set flag that new packing locality created and new blocks for the content * of that directory are not displaced yet */
@@ -767,11 +754,14 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
767 } 754 }
768 new_inode_init(inode, dir, mode); 755 new_inode_init(inode, dir, mode);
769 756
770 locked = reiserfs_cache_default_acl(dir); 757 jbegin_count += reiserfs_cache_default_acl(dir);
771 758 retval = reiserfs_security_init(dir, inode, &security);
759 if (retval < 0) {
760 drop_new_inode(inode);
761 return retval;
762 }
763 jbegin_count += retval;
772 reiserfs_write_lock(dir->i_sb); 764 reiserfs_write_lock(dir->i_sb);
773 if (locked)
774 reiserfs_write_lock_xattrs(dir->i_sb);
775 765
776 retval = journal_begin(&th, dir->i_sb, jbegin_count); 766 retval = journal_begin(&th, dir->i_sb, jbegin_count);
777 if (retval) { 767 if (retval) {
@@ -787,17 +777,12 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
787 retval = reiserfs_new_inode(&th, dir, mode, NULL /*symlink */ , 777 retval = reiserfs_new_inode(&th, dir, mode, NULL /*symlink */ ,
788 old_format_only(dir->i_sb) ? 778 old_format_only(dir->i_sb) ?
789 EMPTY_DIR_SIZE_V1 : EMPTY_DIR_SIZE, 779 EMPTY_DIR_SIZE_V1 : EMPTY_DIR_SIZE,
790 dentry, inode); 780 dentry, inode, &security);
791 if (retval) { 781 if (retval) {
792 dir->i_nlink--; 782 dir->i_nlink--;
793 goto out_failed; 783 goto out_failed;
794 } 784 }
795 785
796 if (locked) {
797 reiserfs_write_unlock_xattrs(dir->i_sb);
798 locked = 0;
799 }
800
801 reiserfs_update_inode_transaction(inode); 786 reiserfs_update_inode_transaction(inode);
802 reiserfs_update_inode_transaction(dir); 787 reiserfs_update_inode_transaction(dir);
803 788
@@ -827,8 +812,6 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
827 unlock_new_inode(inode); 812 unlock_new_inode(inode);
828 retval = journal_end(&th, dir->i_sb, jbegin_count); 813 retval = journal_end(&th, dir->i_sb, jbegin_count);
829 out_failed: 814 out_failed:
830 if (locked)
831 reiserfs_write_unlock_xattrs(dir->i_sb);
832 reiserfs_write_unlock(dir->i_sb); 815 reiserfs_write_unlock(dir->i_sb);
833 return retval; 816 return retval;
834} 817}
@@ -837,7 +820,7 @@ static inline int reiserfs_empty_dir(struct inode *inode)
837{ 820{
838 /* we can cheat because an old format dir cannot have 821 /* we can cheat because an old format dir cannot have
839 ** EMPTY_DIR_SIZE, and a new format dir cannot have 822 ** EMPTY_DIR_SIZE, and a new format dir cannot have
840 ** EMPTY_DIR_SIZE_V1. So, if the inode is either size, 823 ** EMPTY_DIR_SIZE_V1. So, if the inode is either size,
841 ** regardless of disk format version, the directory is empty. 824 ** regardless of disk format version, the directory is empty.
842 */ 825 */
843 if (inode->i_size != EMPTY_DIR_SIZE && 826 if (inode->i_size != EMPTY_DIR_SIZE &&
@@ -903,8 +886,9 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
903 goto end_rmdir; 886 goto end_rmdir;
904 887
905 if (inode->i_nlink != 2 && inode->i_nlink != 1) 888 if (inode->i_nlink != 2 && inode->i_nlink != 1)
906 reiserfs_warning(inode->i_sb, "%s: empty directory has nlink " 889 reiserfs_error(inode->i_sb, "reiserfs-7040",
907 "!= 2 (%d)", __func__, inode->i_nlink); 890 "empty directory has nlink != 2 (%d)",
891 inode->i_nlink);
908 892
909 clear_nlink(inode); 893 clear_nlink(inode);
910 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; 894 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
@@ -980,10 +964,9 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
980 } 964 }
981 965
982 if (!inode->i_nlink) { 966 if (!inode->i_nlink) {
983 reiserfs_warning(inode->i_sb, "%s: deleting nonexistent file " 967 reiserfs_warning(inode->i_sb, "reiserfs-7042",
984 "(%s:%lu), %d", __func__, 968 "deleting nonexistent file (%lu), %d",
985 reiserfs_bdevname(inode->i_sb), inode->i_ino, 969 inode->i_ino, inode->i_nlink);
986 inode->i_nlink);
987 inode->i_nlink = 1; 970 inode->i_nlink = 1;
988 } 971 }
989 972
@@ -1037,6 +1020,7 @@ static int reiserfs_symlink(struct inode *parent_dir,
1037 char *name; 1020 char *name;
1038 int item_len; 1021 int item_len;
1039 struct reiserfs_transaction_handle th; 1022 struct reiserfs_transaction_handle th;
1023 struct reiserfs_security_handle security;
1040 int mode = S_IFLNK | S_IRWXUGO; 1024 int mode = S_IFLNK | S_IRWXUGO;
1041 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */ 1025 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
1042 int jbegin_count = 1026 int jbegin_count =
@@ -1049,6 +1033,13 @@ static int reiserfs_symlink(struct inode *parent_dir,
1049 } 1033 }
1050 new_inode_init(inode, parent_dir, mode); 1034 new_inode_init(inode, parent_dir, mode);
1051 1035
1036 retval = reiserfs_security_init(parent_dir, inode, &security);
1037 if (retval < 0) {
1038 drop_new_inode(inode);
1039 return retval;
1040 }
1041 jbegin_count += retval;
1042
1052 reiserfs_write_lock(parent_dir->i_sb); 1043 reiserfs_write_lock(parent_dir->i_sb);
1053 item_len = ROUND_UP(strlen(symname)); 1044 item_len = ROUND_UP(strlen(symname));
1054 if (item_len > MAX_DIRECT_ITEM_LEN(parent_dir->i_sb->s_blocksize)) { 1045 if (item_len > MAX_DIRECT_ITEM_LEN(parent_dir->i_sb->s_blocksize)) {
@@ -1066,8 +1057,6 @@ static int reiserfs_symlink(struct inode *parent_dir,
1066 memcpy(name, symname, strlen(symname)); 1057 memcpy(name, symname, strlen(symname));
1067 padd_item(name, item_len, strlen(symname)); 1058 padd_item(name, item_len, strlen(symname));
1068 1059
1069 /* We would inherit the default ACL here, but symlinks don't get ACLs */
1070
1071 retval = journal_begin(&th, parent_dir->i_sb, jbegin_count); 1060 retval = journal_begin(&th, parent_dir->i_sb, jbegin_count);
1072 if (retval) { 1061 if (retval) {
1073 drop_new_inode(inode); 1062 drop_new_inode(inode);
@@ -1077,7 +1066,7 @@ static int reiserfs_symlink(struct inode *parent_dir,
1077 1066
1078 retval = 1067 retval =
1079 reiserfs_new_inode(&th, parent_dir, mode, name, strlen(symname), 1068 reiserfs_new_inode(&th, parent_dir, mode, name, strlen(symname),
1080 dentry, inode); 1069 dentry, inode, &security);
1081 kfree(name); 1070 kfree(name);
1082 if (retval) { /* reiserfs_new_inode iputs for us */ 1071 if (retval) { /* reiserfs_new_inode iputs for us */
1083 goto out_failed; 1072 goto out_failed;
@@ -1173,7 +1162,7 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
1173 return retval; 1162 return retval;
1174} 1163}
1175 1164
1176// de contains information pointing to an entry which 1165/* de contains information pointing to an entry which */
1177static int de_still_valid(const char *name, int len, 1166static int de_still_valid(const char *name, int len,
1178 struct reiserfs_dir_entry *de) 1167 struct reiserfs_dir_entry *de)
1179{ 1168{
@@ -1196,15 +1185,14 @@ static int entry_points_to_object(const char *name, int len,
1196 1185
1197 if (inode) { 1186 if (inode) {
1198 if (!de_visible(de->de_deh + de->de_entry_num)) 1187 if (!de_visible(de->de_deh + de->de_entry_num))
1199 reiserfs_panic(NULL, 1188 reiserfs_panic(inode->i_sb, "vs-7042",
1200 "vs-7042: entry_points_to_object: entry must be visible"); 1189 "entry must be visible");
1201 return (de->de_objectid == inode->i_ino) ? 1 : 0; 1190 return (de->de_objectid == inode->i_ino) ? 1 : 0;
1202 } 1191 }
1203 1192
1204 /* this must be added hidden entry */ 1193 /* this must be added hidden entry */
1205 if (de_visible(de->de_deh + de->de_entry_num)) 1194 if (de_visible(de->de_deh + de->de_entry_num))
1206 reiserfs_panic(NULL, 1195 reiserfs_panic(NULL, "vs-7043", "entry must be visible");
1207 "vs-7043: entry_points_to_object: entry must be visible");
1208 1196
1209 return 1; 1197 return 1;
1210} 1198}
@@ -1218,10 +1206,10 @@ static void set_ino_in_dir_entry(struct reiserfs_dir_entry *de,
1218 de->de_deh[de->de_entry_num].deh_objectid = key->k_objectid; 1206 de->de_deh[de->de_entry_num].deh_objectid = key->k_objectid;
1219} 1207}
1220 1208
1221/* 1209/*
1222 * process, that is going to call fix_nodes/do_balance must hold only 1210 * process, that is going to call fix_nodes/do_balance must hold only
1223 * one path. If it holds 2 or more, it can get into endless waiting in 1211 * one path. If it holds 2 or more, it can get into endless waiting in
1224 * get_empty_nodes or its clones 1212 * get_empty_nodes or its clones
1225 */ 1213 */
1226static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry, 1214static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1227 struct inode *new_dir, struct dentry *new_dentry) 1215 struct inode *new_dir, struct dentry *new_dentry)
@@ -1275,7 +1263,7 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1275 1263
1276 old_inode_mode = old_inode->i_mode; 1264 old_inode_mode = old_inode->i_mode;
1277 if (S_ISDIR(old_inode_mode)) { 1265 if (S_ISDIR(old_inode_mode)) {
1278 // make sure, that directory being renamed has correct ".." 1266 // make sure, that directory being renamed has correct ".."
1279 // and that its new parent directory has not too many links 1267 // and that its new parent directory has not too many links
1280 // already 1268 // already
1281 1269
@@ -1286,8 +1274,8 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1286 } 1274 }
1287 } 1275 }
1288 1276
1289 /* directory is renamed, its parent directory will be changed, 1277 /* directory is renamed, its parent directory will be changed,
1290 ** so find ".." entry 1278 ** so find ".." entry
1291 */ 1279 */
1292 dot_dot_de.de_gen_number_bit_string = NULL; 1280 dot_dot_de.de_gen_number_bit_string = NULL;
1293 retval = 1281 retval =
@@ -1318,8 +1306,8 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1318 new_dentry->d_name.len, old_inode, 0); 1306 new_dentry->d_name.len, old_inode, 0);
1319 if (retval == -EEXIST) { 1307 if (retval == -EEXIST) {
1320 if (!new_dentry_inode) { 1308 if (!new_dentry_inode) {
1321 reiserfs_panic(old_dir->i_sb, 1309 reiserfs_panic(old_dir->i_sb, "vs-7050",
1322 "vs-7050: new entry is found, new inode == 0\n"); 1310 "new entry is found, new inode == 0");
1323 } 1311 }
1324 } else if (retval) { 1312 } else if (retval) {
1325 int err = journal_end(&th, old_dir->i_sb, jbegin_count); 1313 int err = journal_end(&th, old_dir->i_sb, jbegin_count);
@@ -1397,9 +1385,9 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1397 this stuff, yes? Then, having 1385 this stuff, yes? Then, having
1398 gathered everything into RAM we 1386 gathered everything into RAM we
1399 should lock the buffers, yes? -Hans */ 1387 should lock the buffers, yes? -Hans */
1400 /* probably. our rename needs to hold more 1388 /* probably. our rename needs to hold more
1401 ** than one path at once. The seals would 1389 ** than one path at once. The seals would
1402 ** have to be written to deal with multi-path 1390 ** have to be written to deal with multi-path
1403 ** issues -chris 1391 ** issues -chris
1404 */ 1392 */
1405 /* sanity checking before doing the rename - avoid races many 1393 /* sanity checking before doing the rename - avoid races many
@@ -1477,7 +1465,7 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1477 } 1465 }
1478 1466
1479 if (S_ISDIR(old_inode_mode)) { 1467 if (S_ISDIR(old_inode_mode)) {
1480 // adjust ".." of renamed directory 1468 /* adjust ".." of renamed directory */
1481 set_ino_in_dir_entry(&dot_dot_de, INODE_PKEY(new_dir)); 1469 set_ino_in_dir_entry(&dot_dot_de, INODE_PKEY(new_dir));
1482 journal_mark_dirty(&th, new_dir->i_sb, dot_dot_de.de_bh); 1470 journal_mark_dirty(&th, new_dir->i_sb, dot_dot_de.de_bh);
1483 1471
@@ -1499,8 +1487,8 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1499 if (reiserfs_cut_from_item 1487 if (reiserfs_cut_from_item
1500 (&th, &old_entry_path, &(old_de.de_entry_key), old_dir, NULL, 1488 (&th, &old_entry_path, &(old_de.de_entry_key), old_dir, NULL,
1501 0) < 0) 1489 0) < 0)
1502 reiserfs_warning(old_dir->i_sb, 1490 reiserfs_error(old_dir->i_sb, "vs-7060",
1503 "vs-7060: reiserfs_rename: couldn't not cut old name. Fsck later?"); 1491 "couldn't not cut old name. Fsck later?");
1504 1492
1505 old_dir->i_size -= DEH_SIZE + old_de.de_entrylen; 1493 old_dir->i_size -= DEH_SIZE + old_de.de_entrylen;
1506 1494