diff options
Diffstat (limited to 'fs/udf/namei.c')
-rw-r--r-- | fs/udf/namei.c | 107 |
1 files changed, 29 insertions, 78 deletions
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 6d8dc02baebb..2be0f9eb86d2 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/errno.h> | 27 | #include <linux/errno.h> |
28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/smp_lock.h> | ||
31 | #include <linux/buffer_head.h> | 30 | #include <linux/buffer_head.h> |
32 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
33 | #include <linux/crc-itu-t.h> | 32 | #include <linux/crc-itu-t.h> |
@@ -228,10 +227,8 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir, | |||
228 | } | 227 | } |
229 | 228 | ||
230 | if ((cfi->fileCharacteristics & FID_FILE_CHAR_PARENT) && | 229 | if ((cfi->fileCharacteristics & FID_FILE_CHAR_PARENT) && |
231 | isdotdot) { | 230 | isdotdot) |
232 | brelse(epos.bh); | 231 | goto out_ok; |
233 | return fi; | ||
234 | } | ||
235 | 232 | ||
236 | if (!lfi) | 233 | if (!lfi) |
237 | continue; | 234 | continue; |
@@ -263,7 +260,6 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry, | |||
263 | if (dentry->d_name.len > UDF_NAME_LEN - 2) | 260 | if (dentry->d_name.len > UDF_NAME_LEN - 2) |
264 | return ERR_PTR(-ENAMETOOLONG); | 261 | return ERR_PTR(-ENAMETOOLONG); |
265 | 262 | ||
266 | lock_kernel(); | ||
267 | #ifdef UDF_RECOVERY | 263 | #ifdef UDF_RECOVERY |
268 | /* temporary shorthand for specifying files by inode number */ | 264 | /* temporary shorthand for specifying files by inode number */ |
269 | if (!strncmp(dentry->d_name.name, ".B=", 3)) { | 265 | if (!strncmp(dentry->d_name.name, ".B=", 3)) { |
@@ -275,7 +271,6 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry, | |||
275 | }; | 271 | }; |
276 | inode = udf_iget(dir->i_sb, lb); | 272 | inode = udf_iget(dir->i_sb, lb); |
277 | if (!inode) { | 273 | if (!inode) { |
278 | unlock_kernel(); | ||
279 | return ERR_PTR(-EACCES); | 274 | return ERR_PTR(-EACCES); |
280 | } | 275 | } |
281 | } else | 276 | } else |
@@ -291,11 +286,9 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry, | |||
291 | loc = lelb_to_cpu(cfi.icb.extLocation); | 286 | loc = lelb_to_cpu(cfi.icb.extLocation); |
292 | inode = udf_iget(dir->i_sb, &loc); | 287 | inode = udf_iget(dir->i_sb, &loc); |
293 | if (!inode) { | 288 | if (!inode) { |
294 | unlock_kernel(); | ||
295 | return ERR_PTR(-EACCES); | 289 | return ERR_PTR(-EACCES); |
296 | } | 290 | } |
297 | } | 291 | } |
298 | unlock_kernel(); | ||
299 | 292 | ||
300 | return d_splice_alias(inode, dentry); | 293 | return d_splice_alias(inode, dentry); |
301 | } | 294 | } |
@@ -476,15 +469,19 @@ add: | |||
476 | f_pos >> dir->i_sb->s_blocksize_bits, 1, err); | 469 | f_pos >> dir->i_sb->s_blocksize_bits, 1, err); |
477 | if (!fibh->ebh) | 470 | if (!fibh->ebh) |
478 | goto out_err; | 471 | goto out_err; |
472 | /* Extents could have been merged, invalidate our position */ | ||
473 | brelse(epos.bh); | ||
474 | epos.bh = NULL; | ||
475 | epos.block = dinfo->i_location; | ||
476 | epos.offset = udf_file_entry_alloc_offset(dir); | ||
479 | 477 | ||
480 | if (!fibh->soffset) { | 478 | if (!fibh->soffset) { |
481 | if (udf_next_aext(dir, &epos, &eloc, &elen, 1) == | 479 | /* Find the freshly allocated block */ |
482 | (EXT_RECORDED_ALLOCATED >> 30)) { | 480 | while (udf_next_aext(dir, &epos, &eloc, &elen, 1) == |
483 | block = eloc.logicalBlockNum + ((elen - 1) >> | 481 | (EXT_RECORDED_ALLOCATED >> 30)) |
482 | ; | ||
483 | block = eloc.logicalBlockNum + ((elen - 1) >> | ||
484 | dir->i_sb->s_blocksize_bits); | 484 | dir->i_sb->s_blocksize_bits); |
485 | } else | ||
486 | block++; | ||
487 | |||
488 | brelse(fibh->sbh); | 485 | brelse(fibh->sbh); |
489 | fibh->sbh = fibh->ebh; | 486 | fibh->sbh = fibh->ebh; |
490 | fi = (struct fileIdentDesc *)(fibh->sbh->b_data); | 487 | fi = (struct fileIdentDesc *)(fibh->sbh->b_data); |
@@ -562,10 +559,8 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode, | |||
562 | int err; | 559 | int err; |
563 | struct udf_inode_info *iinfo; | 560 | struct udf_inode_info *iinfo; |
564 | 561 | ||
565 | lock_kernel(); | ||
566 | inode = udf_new_inode(dir, mode, &err); | 562 | inode = udf_new_inode(dir, mode, &err); |
567 | if (!inode) { | 563 | if (!inode) { |
568 | unlock_kernel(); | ||
569 | return err; | 564 | return err; |
570 | } | 565 | } |
571 | 566 | ||
@@ -583,7 +578,6 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode, | |||
583 | inode->i_nlink--; | 578 | inode->i_nlink--; |
584 | mark_inode_dirty(inode); | 579 | mark_inode_dirty(inode); |
585 | iput(inode); | 580 | iput(inode); |
586 | unlock_kernel(); | ||
587 | return err; | 581 | return err; |
588 | } | 582 | } |
589 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); | 583 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); |
@@ -596,7 +590,6 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode, | |||
596 | if (fibh.sbh != fibh.ebh) | 590 | if (fibh.sbh != fibh.ebh) |
597 | brelse(fibh.ebh); | 591 | brelse(fibh.ebh); |
598 | brelse(fibh.sbh); | 592 | brelse(fibh.sbh); |
599 | unlock_kernel(); | ||
600 | d_instantiate(dentry, inode); | 593 | d_instantiate(dentry, inode); |
601 | 594 | ||
602 | return 0; | 595 | return 0; |
@@ -614,7 +607,6 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode, | |||
614 | if (!old_valid_dev(rdev)) | 607 | if (!old_valid_dev(rdev)) |
615 | return -EINVAL; | 608 | return -EINVAL; |
616 | 609 | ||
617 | lock_kernel(); | ||
618 | err = -EIO; | 610 | err = -EIO; |
619 | inode = udf_new_inode(dir, mode, &err); | 611 | inode = udf_new_inode(dir, mode, &err); |
620 | if (!inode) | 612 | if (!inode) |
@@ -627,7 +619,6 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode, | |||
627 | inode->i_nlink--; | 619 | inode->i_nlink--; |
628 | mark_inode_dirty(inode); | 620 | mark_inode_dirty(inode); |
629 | iput(inode); | 621 | iput(inode); |
630 | unlock_kernel(); | ||
631 | return err; | 622 | return err; |
632 | } | 623 | } |
633 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); | 624 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); |
@@ -646,7 +637,6 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode, | |||
646 | err = 0; | 637 | err = 0; |
647 | 638 | ||
648 | out: | 639 | out: |
649 | unlock_kernel(); | ||
650 | return err; | 640 | return err; |
651 | } | 641 | } |
652 | 642 | ||
@@ -659,7 +649,6 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
659 | struct udf_inode_info *dinfo = UDF_I(dir); | 649 | struct udf_inode_info *dinfo = UDF_I(dir); |
660 | struct udf_inode_info *iinfo; | 650 | struct udf_inode_info *iinfo; |
661 | 651 | ||
662 | lock_kernel(); | ||
663 | err = -EMLINK; | 652 | err = -EMLINK; |
664 | if (dir->i_nlink >= (256 << sizeof(dir->i_nlink)) - 1) | 653 | if (dir->i_nlink >= (256 << sizeof(dir->i_nlink)) - 1) |
665 | goto out; | 654 | goto out; |
@@ -712,7 +701,6 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
712 | err = 0; | 701 | err = 0; |
713 | 702 | ||
714 | out: | 703 | out: |
715 | unlock_kernel(); | ||
716 | return err; | 704 | return err; |
717 | } | 705 | } |
718 | 706 | ||
@@ -794,7 +782,6 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry) | |||
794 | struct kernel_lb_addr tloc; | 782 | struct kernel_lb_addr tloc; |
795 | 783 | ||
796 | retval = -ENOENT; | 784 | retval = -ENOENT; |
797 | lock_kernel(); | ||
798 | fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); | 785 | fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); |
799 | if (!fi) | 786 | if (!fi) |
800 | goto out; | 787 | goto out; |
@@ -826,7 +813,6 @@ end_rmdir: | |||
826 | brelse(fibh.sbh); | 813 | brelse(fibh.sbh); |
827 | 814 | ||
828 | out: | 815 | out: |
829 | unlock_kernel(); | ||
830 | return retval; | 816 | return retval; |
831 | } | 817 | } |
832 | 818 | ||
@@ -840,7 +826,6 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry) | |||
840 | struct kernel_lb_addr tloc; | 826 | struct kernel_lb_addr tloc; |
841 | 827 | ||
842 | retval = -ENOENT; | 828 | retval = -ENOENT; |
843 | lock_kernel(); | ||
844 | fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); | 829 | fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); |
845 | if (!fi) | 830 | if (!fi) |
846 | goto out; | 831 | goto out; |
@@ -870,7 +855,6 @@ end_unlink: | |||
870 | brelse(fibh.sbh); | 855 | brelse(fibh.sbh); |
871 | 856 | ||
872 | out: | 857 | out: |
873 | unlock_kernel(); | ||
874 | return retval; | 858 | return retval; |
875 | } | 859 | } |
876 | 860 | ||
@@ -890,21 +874,21 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
890 | int block; | 874 | int block; |
891 | unsigned char *name = NULL; | 875 | unsigned char *name = NULL; |
892 | int namelen; | 876 | int namelen; |
893 | struct buffer_head *bh; | ||
894 | struct udf_inode_info *iinfo; | 877 | struct udf_inode_info *iinfo; |
878 | struct super_block *sb = dir->i_sb; | ||
895 | 879 | ||
896 | lock_kernel(); | ||
897 | inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO, &err); | 880 | inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO, &err); |
898 | if (!inode) | 881 | if (!inode) |
899 | goto out; | 882 | goto out; |
900 | 883 | ||
884 | iinfo = UDF_I(inode); | ||
885 | down_write(&iinfo->i_data_sem); | ||
901 | name = kmalloc(UDF_NAME_LEN, GFP_NOFS); | 886 | name = kmalloc(UDF_NAME_LEN, GFP_NOFS); |
902 | if (!name) { | 887 | if (!name) { |
903 | err = -ENOMEM; | 888 | err = -ENOMEM; |
904 | goto out_no_entry; | 889 | goto out_no_entry; |
905 | } | 890 | } |
906 | 891 | ||
907 | iinfo = UDF_I(inode); | ||
908 | inode->i_data.a_ops = &udf_symlink_aops; | 892 | inode->i_data.a_ops = &udf_symlink_aops; |
909 | inode->i_op = &udf_symlink_inode_operations; | 893 | inode->i_op = &udf_symlink_inode_operations; |
910 | 894 | ||
@@ -912,7 +896,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
912 | struct kernel_lb_addr eloc; | 896 | struct kernel_lb_addr eloc; |
913 | uint32_t bsize; | 897 | uint32_t bsize; |
914 | 898 | ||
915 | block = udf_new_block(inode->i_sb, inode, | 899 | block = udf_new_block(sb, inode, |
916 | iinfo->i_location.partitionReferenceNum, | 900 | iinfo->i_location.partitionReferenceNum, |
917 | iinfo->i_location.logicalBlockNum, &err); | 901 | iinfo->i_location.logicalBlockNum, &err); |
918 | if (!block) | 902 | if (!block) |
@@ -923,17 +907,17 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
923 | eloc.logicalBlockNum = block; | 907 | eloc.logicalBlockNum = block; |
924 | eloc.partitionReferenceNum = | 908 | eloc.partitionReferenceNum = |
925 | iinfo->i_location.partitionReferenceNum; | 909 | iinfo->i_location.partitionReferenceNum; |
926 | bsize = inode->i_sb->s_blocksize; | 910 | bsize = sb->s_blocksize; |
927 | iinfo->i_lenExtents = bsize; | 911 | iinfo->i_lenExtents = bsize; |
928 | udf_add_aext(inode, &epos, &eloc, bsize, 0); | 912 | udf_add_aext(inode, &epos, &eloc, bsize, 0); |
929 | brelse(epos.bh); | 913 | brelse(epos.bh); |
930 | 914 | ||
931 | block = udf_get_pblock(inode->i_sb, block, | 915 | block = udf_get_pblock(sb, block, |
932 | iinfo->i_location.partitionReferenceNum, | 916 | iinfo->i_location.partitionReferenceNum, |
933 | 0); | 917 | 0); |
934 | epos.bh = udf_tgetblk(inode->i_sb, block); | 918 | epos.bh = udf_tgetblk(sb, block); |
935 | lock_buffer(epos.bh); | 919 | lock_buffer(epos.bh); |
936 | memset(epos.bh->b_data, 0x00, inode->i_sb->s_blocksize); | 920 | memset(epos.bh->b_data, 0x00, bsize); |
937 | set_buffer_uptodate(epos.bh); | 921 | set_buffer_uptodate(epos.bh); |
938 | unlock_buffer(epos.bh); | 922 | unlock_buffer(epos.bh); |
939 | mark_buffer_dirty_inode(epos.bh, inode); | 923 | mark_buffer_dirty_inode(epos.bh, inode); |
@@ -941,7 +925,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
941 | } else | 925 | } else |
942 | ea = iinfo->i_ext.i_data + iinfo->i_lenEAttr; | 926 | ea = iinfo->i_ext.i_data + iinfo->i_lenEAttr; |
943 | 927 | ||
944 | eoffset = inode->i_sb->s_blocksize - udf_ext0_offset(inode); | 928 | eoffset = sb->s_blocksize - udf_ext0_offset(inode); |
945 | pc = (struct pathComponent *)ea; | 929 | pc = (struct pathComponent *)ea; |
946 | 930 | ||
947 | if (*symname == '/') { | 931 | if (*symname == '/') { |
@@ -981,7 +965,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
981 | } | 965 | } |
982 | 966 | ||
983 | if (pc->componentType == 5) { | 967 | if (pc->componentType == 5) { |
984 | namelen = udf_put_filename(inode->i_sb, compstart, name, | 968 | namelen = udf_put_filename(sb, compstart, name, |
985 | symname - compstart); | 969 | symname - compstart); |
986 | if (!namelen) | 970 | if (!namelen) |
987 | goto out_no_entry; | 971 | goto out_no_entry; |
@@ -1015,27 +999,16 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
1015 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); | 999 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); |
1016 | if (!fi) | 1000 | if (!fi) |
1017 | goto out_no_entry; | 1001 | goto out_no_entry; |
1018 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); | 1002 | cfi.icb.extLength = cpu_to_le32(sb->s_blocksize); |
1019 | cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location); | 1003 | cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location); |
1020 | bh = UDF_SB(inode->i_sb)->s_lvid_bh; | 1004 | if (UDF_SB(inode->i_sb)->s_lvid_bh) { |
1021 | if (bh) { | ||
1022 | struct logicalVolIntegrityDesc *lvid = | ||
1023 | (struct logicalVolIntegrityDesc *)bh->b_data; | ||
1024 | struct logicalVolHeaderDesc *lvhd; | ||
1025 | uint64_t uniqueID; | ||
1026 | lvhd = (struct logicalVolHeaderDesc *) | ||
1027 | lvid->logicalVolContentsUse; | ||
1028 | uniqueID = le64_to_cpu(lvhd->uniqueID); | ||
1029 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = | 1005 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = |
1030 | cpu_to_le32(uniqueID & 0x00000000FFFFFFFFUL); | 1006 | cpu_to_le32(lvid_get_unique_id(sb)); |
1031 | if (!(++uniqueID & 0x00000000FFFFFFFFUL)) | ||
1032 | uniqueID += 16; | ||
1033 | lvhd->uniqueID = cpu_to_le64(uniqueID); | ||
1034 | mark_buffer_dirty(bh); | ||
1035 | } | 1007 | } |
1036 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); | 1008 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); |
1037 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | 1009 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
1038 | mark_inode_dirty(dir); | 1010 | mark_inode_dirty(dir); |
1011 | up_write(&iinfo->i_data_sem); | ||
1039 | if (fibh.sbh != fibh.ebh) | 1012 | if (fibh.sbh != fibh.ebh) |
1040 | brelse(fibh.ebh); | 1013 | brelse(fibh.ebh); |
1041 | brelse(fibh.sbh); | 1014 | brelse(fibh.sbh); |
@@ -1044,10 +1017,10 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
1044 | 1017 | ||
1045 | out: | 1018 | out: |
1046 | kfree(name); | 1019 | kfree(name); |
1047 | unlock_kernel(); | ||
1048 | return err; | 1020 | return err; |
1049 | 1021 | ||
1050 | out_no_entry: | 1022 | out_no_entry: |
1023 | up_write(&iinfo->i_data_sem); | ||
1051 | inode_dec_link_count(inode); | 1024 | inode_dec_link_count(inode); |
1052 | iput(inode); | 1025 | iput(inode); |
1053 | goto out; | 1026 | goto out; |
@@ -1060,36 +1033,20 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir, | |||
1060 | struct udf_fileident_bh fibh; | 1033 | struct udf_fileident_bh fibh; |
1061 | struct fileIdentDesc cfi, *fi; | 1034 | struct fileIdentDesc cfi, *fi; |
1062 | int err; | 1035 | int err; |
1063 | struct buffer_head *bh; | ||
1064 | 1036 | ||
1065 | lock_kernel(); | ||
1066 | if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) { | 1037 | if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) { |
1067 | unlock_kernel(); | ||
1068 | return -EMLINK; | 1038 | return -EMLINK; |
1069 | } | 1039 | } |
1070 | 1040 | ||
1071 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); | 1041 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); |
1072 | if (!fi) { | 1042 | if (!fi) { |
1073 | unlock_kernel(); | ||
1074 | return err; | 1043 | return err; |
1075 | } | 1044 | } |
1076 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); | 1045 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); |
1077 | cfi.icb.extLocation = cpu_to_lelb(UDF_I(inode)->i_location); | 1046 | cfi.icb.extLocation = cpu_to_lelb(UDF_I(inode)->i_location); |
1078 | bh = UDF_SB(inode->i_sb)->s_lvid_bh; | 1047 | if (UDF_SB(inode->i_sb)->s_lvid_bh) { |
1079 | if (bh) { | ||
1080 | struct logicalVolIntegrityDesc *lvid = | ||
1081 | (struct logicalVolIntegrityDesc *)bh->b_data; | ||
1082 | struct logicalVolHeaderDesc *lvhd; | ||
1083 | uint64_t uniqueID; | ||
1084 | lvhd = (struct logicalVolHeaderDesc *) | ||
1085 | (lvid->logicalVolContentsUse); | ||
1086 | uniqueID = le64_to_cpu(lvhd->uniqueID); | ||
1087 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = | 1048 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = |
1088 | cpu_to_le32(uniqueID & 0x00000000FFFFFFFFUL); | 1049 | cpu_to_le32(lvid_get_unique_id(inode->i_sb)); |
1089 | if (!(++uniqueID & 0x00000000FFFFFFFFUL)) | ||
1090 | uniqueID += 16; | ||
1091 | lvhd->uniqueID = cpu_to_le64(uniqueID); | ||
1092 | mark_buffer_dirty(bh); | ||
1093 | } | 1050 | } |
1094 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); | 1051 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); |
1095 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | 1052 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
@@ -1103,7 +1060,6 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir, | |||
1103 | mark_inode_dirty(inode); | 1060 | mark_inode_dirty(inode); |
1104 | ihold(inode); | 1061 | ihold(inode); |
1105 | d_instantiate(dentry, inode); | 1062 | d_instantiate(dentry, inode); |
1106 | unlock_kernel(); | ||
1107 | 1063 | ||
1108 | return 0; | 1064 | return 0; |
1109 | } | 1065 | } |
@@ -1124,7 +1080,6 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1124 | struct kernel_lb_addr tloc; | 1080 | struct kernel_lb_addr tloc; |
1125 | struct udf_inode_info *old_iinfo = UDF_I(old_inode); | 1081 | struct udf_inode_info *old_iinfo = UDF_I(old_inode); |
1126 | 1082 | ||
1127 | lock_kernel(); | ||
1128 | ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi); | 1083 | ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi); |
1129 | if (ofi) { | 1084 | if (ofi) { |
1130 | if (ofibh.sbh != ofibh.ebh) | 1085 | if (ofibh.sbh != ofibh.ebh) |
@@ -1248,7 +1203,6 @@ end_rename: | |||
1248 | brelse(nfibh.ebh); | 1203 | brelse(nfibh.ebh); |
1249 | brelse(nfibh.sbh); | 1204 | brelse(nfibh.sbh); |
1250 | } | 1205 | } |
1251 | unlock_kernel(); | ||
1252 | 1206 | ||
1253 | return retval; | 1207 | return retval; |
1254 | } | 1208 | } |
@@ -1261,7 +1215,6 @@ static struct dentry *udf_get_parent(struct dentry *child) | |||
1261 | struct fileIdentDesc cfi; | 1215 | struct fileIdentDesc cfi; |
1262 | struct udf_fileident_bh fibh; | 1216 | struct udf_fileident_bh fibh; |
1263 | 1217 | ||
1264 | lock_kernel(); | ||
1265 | if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi)) | 1218 | if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi)) |
1266 | goto out_unlock; | 1219 | goto out_unlock; |
1267 | 1220 | ||
@@ -1273,11 +1226,9 @@ static struct dentry *udf_get_parent(struct dentry *child) | |||
1273 | inode = udf_iget(child->d_inode->i_sb, &tloc); | 1226 | inode = udf_iget(child->d_inode->i_sb, &tloc); |
1274 | if (!inode) | 1227 | if (!inode) |
1275 | goto out_unlock; | 1228 | goto out_unlock; |
1276 | unlock_kernel(); | ||
1277 | 1229 | ||
1278 | return d_obtain_alias(inode); | 1230 | return d_obtain_alias(inode); |
1279 | out_unlock: | 1231 | out_unlock: |
1280 | unlock_kernel(); | ||
1281 | return ERR_PTR(-EACCES); | 1232 | return ERR_PTR(-EACCES); |
1282 | } | 1233 | } |
1283 | 1234 | ||