diff options
author | Alessio Igor Bogani <abogani@texware.it> | 2010-11-16 12:40:49 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2011-01-06 11:03:57 -0500 |
commit | 9db9f9e31d7661dff35a75ed01ff9fc0d6acdaf8 (patch) | |
tree | 8e95c6f73b86b6f9e2089f61c9c964f44f08558a /fs/udf | |
parent | 7db09be629033b79792a1bf18f505f5f15914395 (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')
-rw-r--r-- | fs/udf/dir.c | 5 | ||||
-rw-r--r-- | fs/udf/file.c | 4 | ||||
-rw-r--r-- | fs/udf/inode.c | 3 | ||||
-rw-r--r-- | fs/udf/namei.c | 27 | ||||
-rw-r--r-- | fs/udf/super.c | 9 |
5 files changed, 1 insertions, 47 deletions
diff --git a/fs/udf/dir.c b/fs/udf/dir.c index 51552bf50225..eb8bfe2b89a5 100644 --- a/fs/udf/dir.c +++ b/fs/udf/dir.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/errno.h> | 30 | #include <linux/errno.h> |
31 | #include <linux/mm.h> | 31 | #include <linux/mm.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/smp_lock.h> | ||
34 | #include <linux/buffer_head.h> | 33 | #include <linux/buffer_head.h> |
35 | 34 | ||
36 | #include "udf_i.h" | 35 | #include "udf_i.h" |
@@ -190,18 +189,14 @@ static int udf_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
190 | struct inode *dir = filp->f_path.dentry->d_inode; | 189 | struct inode *dir = filp->f_path.dentry->d_inode; |
191 | int result; | 190 | int result; |
192 | 191 | ||
193 | lock_kernel(); | ||
194 | |||
195 | if (filp->f_pos == 0) { | 192 | if (filp->f_pos == 0) { |
196 | if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino, DT_DIR) < 0) { | 193 | if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino, DT_DIR) < 0) { |
197 | unlock_kernel(); | ||
198 | return 0; | 194 | return 0; |
199 | } | 195 | } |
200 | filp->f_pos++; | 196 | filp->f_pos++; |
201 | } | 197 | } |
202 | 198 | ||
203 | result = do_udf_readdir(dir, filp, filldir, dirent); | 199 | result = do_udf_readdir(dir, filp, filldir, dirent); |
204 | unlock_kernel(); | ||
205 | return result; | 200 | return result; |
206 | } | 201 | } |
207 | 202 | ||
diff --git a/fs/udf/file.c b/fs/udf/file.c index df0c5561cc7e..4e3bbd81b57b 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/string.h> /* memset */ | 32 | #include <linux/string.h> /* memset */ |
33 | #include <linux/capability.h> | 33 | #include <linux/capability.h> |
34 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
35 | #include <linux/smp_lock.h> | ||
36 | #include <linux/pagemap.h> | 35 | #include <linux/pagemap.h> |
37 | #include <linux/buffer_head.h> | 36 | #include <linux/buffer_head.h> |
38 | #include <linux/aio.h> | 37 | #include <linux/aio.h> |
@@ -149,8 +148,6 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
149 | long old_block, new_block; | 148 | long old_block, new_block; |
150 | int result = -EINVAL; | 149 | int result = -EINVAL; |
151 | 150 | ||
152 | lock_kernel(); | ||
153 | |||
154 | if (file_permission(filp, MAY_READ) != 0) { | 151 | if (file_permission(filp, MAY_READ) != 0) { |
155 | udf_debug("no permission to access inode %lu\n", inode->i_ino); | 152 | udf_debug("no permission to access inode %lu\n", inode->i_ino); |
156 | result = -EPERM; | 153 | result = -EPERM; |
@@ -196,7 +193,6 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
196 | } | 193 | } |
197 | 194 | ||
198 | out: | 195 | out: |
199 | unlock_kernel(); | ||
200 | return result; | 196 | return result; |
201 | } | 197 | } |
202 | 198 | ||
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index b2fe4d7f20eb..c6a2e782b97b 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -31,7 +31,6 @@ | |||
31 | 31 | ||
32 | #include "udfdecl.h" | 32 | #include "udfdecl.h" |
33 | #include <linux/mm.h> | 33 | #include <linux/mm.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/module.h> | 34 | #include <linux/module.h> |
36 | #include <linux/pagemap.h> | 35 | #include <linux/pagemap.h> |
37 | #include <linux/buffer_head.h> | 36 | #include <linux/buffer_head.h> |
@@ -96,9 +95,7 @@ void udf_evict_inode(struct inode *inode) | |||
96 | kfree(iinfo->i_ext.i_data); | 95 | kfree(iinfo->i_ext.i_data); |
97 | iinfo->i_ext.i_data = NULL; | 96 | iinfo->i_ext.i_data = NULL; |
98 | if (want_delete) { | 97 | if (want_delete) { |
99 | lock_kernel(); | ||
100 | udf_free_inode(inode); | 98 | udf_free_inode(inode); |
101 | unlock_kernel(); | ||
102 | } | 99 | } |
103 | } | 100 | } |
104 | 101 | ||
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 | ||
648 | out: | 637 | out: |
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 | ||
714 | out: | 701 | out: |
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 | ||
828 | out: | 813 | out: |
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 | ||
872 | out: | 855 | out: |
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); |
1255 | out_unlock: | 1229 | out_unlock: |
1256 | unlock_kernel(); | ||
1257 | return ERR_PTR(-EACCES); | 1230 | return ERR_PTR(-EACCES); |
1258 | } | 1231 | } |
1259 | 1232 | ||
diff --git a/fs/udf/super.c b/fs/udf/super.c index 441b892cf85e..536f89da4af2 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -48,7 +48,6 @@ | |||
48 | #include <linux/stat.h> | 48 | #include <linux/stat.h> |
49 | #include <linux/cdrom.h> | 49 | #include <linux/cdrom.h> |
50 | #include <linux/nls.h> | 50 | #include <linux/nls.h> |
51 | #include <linux/smp_lock.h> | ||
52 | #include <linux/buffer_head.h> | 51 | #include <linux/buffer_head.h> |
53 | #include <linux/vfs.h> | 52 | #include <linux/vfs.h> |
54 | #include <linux/vmalloc.h> | 53 | #include <linux/vmalloc.h> |
@@ -1911,8 +1910,6 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1911 | struct kernel_lb_addr rootdir, fileset; | 1910 | struct kernel_lb_addr rootdir, fileset; |
1912 | struct udf_sb_info *sbi; | 1911 | struct udf_sb_info *sbi; |
1913 | 1912 | ||
1914 | lock_kernel(); | ||
1915 | |||
1916 | uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT); | 1913 | uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT); |
1917 | uopt.uid = -1; | 1914 | uopt.uid = -1; |
1918 | uopt.gid = -1; | 1915 | uopt.gid = -1; |
@@ -1921,10 +1918,8 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1921 | uopt.dmode = UDF_INVALID_MODE; | 1918 | uopt.dmode = UDF_INVALID_MODE; |
1922 | 1919 | ||
1923 | sbi = kzalloc(sizeof(struct udf_sb_info), GFP_KERNEL); | 1920 | sbi = kzalloc(sizeof(struct udf_sb_info), GFP_KERNEL); |
1924 | if (!sbi) { | 1921 | if (!sbi) |
1925 | unlock_kernel(); | ||
1926 | return -ENOMEM; | 1922 | return -ENOMEM; |
1927 | } | ||
1928 | 1923 | ||
1929 | sb->s_fs_info = sbi; | 1924 | sb->s_fs_info = sbi; |
1930 | 1925 | ||
@@ -2071,7 +2066,6 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
2071 | goto error_out; | 2066 | goto error_out; |
2072 | } | 2067 | } |
2073 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 2068 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
2074 | unlock_kernel(); | ||
2075 | return 0; | 2069 | return 0; |
2076 | 2070 | ||
2077 | error_out: | 2071 | error_out: |
@@ -2092,7 +2086,6 @@ error_out: | |||
2092 | kfree(sbi); | 2086 | kfree(sbi); |
2093 | sb->s_fs_info = NULL; | 2087 | sb->s_fs_info = NULL; |
2094 | 2088 | ||
2095 | unlock_kernel(); | ||
2096 | return -EINVAL; | 2089 | return -EINVAL; |
2097 | } | 2090 | } |
2098 | 2091 | ||