aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/namei.c
diff options
context:
space:
mode:
authorAlessio Igor Bogani <abogani@texware.it>2010-11-16 12:40:49 -0500
committerJan Kara <jack@suse.cz>2011-01-06 11:03:57 -0500
commit9db9f9e31d7661dff35a75ed01ff9fc0d6acdaf8 (patch)
tree8e95c6f73b86b6f9e2089f61c9c964f44f08558a /fs/udf/namei.c
parent7db09be629033b79792a1bf18f505f5f15914395 (diff)
udf: Remove unnecessary bkl usages
The udf_readdir(), udf_lookup(), udf_create(), udf_mknod(), udf_mkdir(), udf_rmdir(), udf_link(), udf_get_parent() and udf_unlink() seems already adequately protected by i_mutex held by VFS invoking calls. The udf_rename() instead should be already protected by lock_rename again by VFS. The udf_ioctl(), udf_fill_super() and udf_evict_inode() don't requires any further protection. This work was supported by a hardware donation from the CE Linux Forum. Signed-off-by: Alessio Igor Bogani <abogani@texware.it> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/namei.c')
-rw-r--r--fs/udf/namei.c27
1 files changed, 0 insertions, 27 deletions
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index d5eb000ddddd..26815a25379d 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>
@@ -263,7 +262,6 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry,
263 if (dentry->d_name.len > UDF_NAME_LEN - 2) 262 if (dentry->d_name.len > UDF_NAME_LEN - 2)
264 return ERR_PTR(-ENAMETOOLONG); 263 return ERR_PTR(-ENAMETOOLONG);
265 264
266 lock_kernel();
267#ifdef UDF_RECOVERY 265#ifdef UDF_RECOVERY
268 /* temporary shorthand for specifying files by inode number */ 266 /* temporary shorthand for specifying files by inode number */
269 if (!strncmp(dentry->d_name.name, ".B=", 3)) { 267 if (!strncmp(dentry->d_name.name, ".B=", 3)) {
@@ -275,7 +273,6 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry,
275 }; 273 };
276 inode = udf_iget(dir->i_sb, lb); 274 inode = udf_iget(dir->i_sb, lb);
277 if (!inode) { 275 if (!inode) {
278 unlock_kernel();
279 return ERR_PTR(-EACCES); 276 return ERR_PTR(-EACCES);
280 } 277 }
281 } else 278 } else
@@ -291,11 +288,9 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry,
291 loc = lelb_to_cpu(cfi.icb.extLocation); 288 loc = lelb_to_cpu(cfi.icb.extLocation);
292 inode = udf_iget(dir->i_sb, &loc); 289 inode = udf_iget(dir->i_sb, &loc);
293 if (!inode) { 290 if (!inode) {
294 unlock_kernel();
295 return ERR_PTR(-EACCES); 291 return ERR_PTR(-EACCES);
296 } 292 }
297 } 293 }
298 unlock_kernel();
299 294
300 return d_splice_alias(inode, dentry); 295 return d_splice_alias(inode, dentry);
301} 296}
@@ -562,10 +557,8 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode,
562 int err; 557 int err;
563 struct udf_inode_info *iinfo; 558 struct udf_inode_info *iinfo;
564 559
565 lock_kernel();
566 inode = udf_new_inode(dir, mode, &err); 560 inode = udf_new_inode(dir, mode, &err);
567 if (!inode) { 561 if (!inode) {
568 unlock_kernel();
569 return err; 562 return err;
570 } 563 }
571 564
@@ -583,7 +576,6 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode,
583 inode->i_nlink--; 576 inode->i_nlink--;
584 mark_inode_dirty(inode); 577 mark_inode_dirty(inode);
585 iput(inode); 578 iput(inode);
586 unlock_kernel();
587 return err; 579 return err;
588 } 580 }
589 cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); 581 cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
@@ -596,7 +588,6 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode,
596 if (fibh.sbh != fibh.ebh) 588 if (fibh.sbh != fibh.ebh)
597 brelse(fibh.ebh); 589 brelse(fibh.ebh);
598 brelse(fibh.sbh); 590 brelse(fibh.sbh);
599 unlock_kernel();
600 d_instantiate(dentry, inode); 591 d_instantiate(dentry, inode);
601 592
602 return 0; 593 return 0;
@@ -614,7 +605,6 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode,
614 if (!old_valid_dev(rdev)) 605 if (!old_valid_dev(rdev))
615 return -EINVAL; 606 return -EINVAL;
616 607
617 lock_kernel();
618 err = -EIO; 608 err = -EIO;
619 inode = udf_new_inode(dir, mode, &err); 609 inode = udf_new_inode(dir, mode, &err);
620 if (!inode) 610 if (!inode)
@@ -627,7 +617,6 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode,
627 inode->i_nlink--; 617 inode->i_nlink--;
628 mark_inode_dirty(inode); 618 mark_inode_dirty(inode);
629 iput(inode); 619 iput(inode);
630 unlock_kernel();
631 return err; 620 return err;
632 } 621 }
633 cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); 622 cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
@@ -646,7 +635,6 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode,
646 err = 0; 635 err = 0;
647 636
648out: 637out:
649 unlock_kernel();
650 return err; 638 return err;
651} 639}
652 640
@@ -659,7 +647,6 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode)
659 struct udf_inode_info *dinfo = UDF_I(dir); 647 struct udf_inode_info *dinfo = UDF_I(dir);
660 struct udf_inode_info *iinfo; 648 struct udf_inode_info *iinfo;
661 649
662 lock_kernel();
663 err = -EMLINK; 650 err = -EMLINK;
664 if (dir->i_nlink >= (256 << sizeof(dir->i_nlink)) - 1) 651 if (dir->i_nlink >= (256 << sizeof(dir->i_nlink)) - 1)
665 goto out; 652 goto out;
@@ -712,7 +699,6 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode)
712 err = 0; 699 err = 0;
713 700
714out: 701out:
715 unlock_kernel();
716 return err; 702 return err;
717} 703}
718 704
@@ -794,7 +780,6 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
794 struct kernel_lb_addr tloc; 780 struct kernel_lb_addr tloc;
795 781
796 retval = -ENOENT; 782 retval = -ENOENT;
797 lock_kernel();
798 fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); 783 fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi);
799 if (!fi) 784 if (!fi)
800 goto out; 785 goto out;
@@ -826,7 +811,6 @@ end_rmdir:
826 brelse(fibh.sbh); 811 brelse(fibh.sbh);
827 812
828out: 813out:
829 unlock_kernel();
830 return retval; 814 return retval;
831} 815}
832 816
@@ -840,7 +824,6 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry)
840 struct kernel_lb_addr tloc; 824 struct kernel_lb_addr tloc;
841 825
842 retval = -ENOENT; 826 retval = -ENOENT;
843 lock_kernel();
844 fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); 827 fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi);
845 if (!fi) 828 if (!fi)
846 goto out; 829 goto out;
@@ -870,7 +853,6 @@ end_unlink:
870 brelse(fibh.sbh); 853 brelse(fibh.sbh);
871 854
872out: 855out:
873 unlock_kernel();
874 return retval; 856 return retval;
875} 857}
876 858
@@ -1050,15 +1032,12 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
1050 struct fileIdentDesc cfi, *fi; 1032 struct fileIdentDesc cfi, *fi;
1051 int err; 1033 int err;
1052 1034
1053 lock_kernel();
1054 if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) { 1035 if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) {
1055 unlock_kernel();
1056 return -EMLINK; 1036 return -EMLINK;
1057 } 1037 }
1058 1038
1059 fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); 1039 fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err);
1060 if (!fi) { 1040 if (!fi) {
1061 unlock_kernel();
1062 return err; 1041 return err;
1063 } 1042 }
1064 cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); 1043 cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
@@ -1079,7 +1058,6 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
1079 mark_inode_dirty(inode); 1058 mark_inode_dirty(inode);
1080 ihold(inode); 1059 ihold(inode);
1081 d_instantiate(dentry, inode); 1060 d_instantiate(dentry, inode);
1082 unlock_kernel();
1083 1061
1084 return 0; 1062 return 0;
1085} 1063}
@@ -1100,7 +1078,6 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
1100 struct kernel_lb_addr tloc; 1078 struct kernel_lb_addr tloc;
1101 struct udf_inode_info *old_iinfo = UDF_I(old_inode); 1079 struct udf_inode_info *old_iinfo = UDF_I(old_inode);
1102 1080
1103 lock_kernel();
1104 ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi); 1081 ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi);
1105 if (ofi) { 1082 if (ofi) {
1106 if (ofibh.sbh != ofibh.ebh) 1083 if (ofibh.sbh != ofibh.ebh)
@@ -1224,7 +1201,6 @@ end_rename:
1224 brelse(nfibh.ebh); 1201 brelse(nfibh.ebh);
1225 brelse(nfibh.sbh); 1202 brelse(nfibh.sbh);
1226 } 1203 }
1227 unlock_kernel();
1228 1204
1229 return retval; 1205 return retval;
1230} 1206}
@@ -1237,7 +1213,6 @@ static struct dentry *udf_get_parent(struct dentry *child)
1237 struct fileIdentDesc cfi; 1213 struct fileIdentDesc cfi;
1238 struct udf_fileident_bh fibh; 1214 struct udf_fileident_bh fibh;
1239 1215
1240 lock_kernel();
1241 if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi)) 1216 if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi))
1242 goto out_unlock; 1217 goto out_unlock;
1243 1218
@@ -1249,11 +1224,9 @@ static struct dentry *udf_get_parent(struct dentry *child)
1249 inode = udf_iget(child->d_inode->i_sb, &tloc); 1224 inode = udf_iget(child->d_inode->i_sb, &tloc);
1250 if (!inode) 1225 if (!inode)
1251 goto out_unlock; 1226 goto out_unlock;
1252 unlock_kernel();
1253 1227
1254 return d_obtain_alias(inode); 1228 return d_obtain_alias(inode);
1255out_unlock: 1229out_unlock:
1256 unlock_kernel();
1257 return ERR_PTR(-EACCES); 1230 return ERR_PTR(-EACCES);
1258} 1231}
1259 1232