diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 17:48:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 17:48:31 -0400 |
commit | d1794f2c5b5817eb79ccc5e00701ca748d1b073a (patch) | |
tree | 5a4c98e694e88a8c82f342d0cc9edb2a4cbbef36 /fs | |
parent | a41eebab7537890409ea9dfe0fcda9b5fbdb090d (diff) | |
parent | 2fceef397f9880b212a74c418290ce69e7ac00eb (diff) |
Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
* 'bkl-removal' of git://git.lwn.net/linux-2.6: (146 commits)
IB/umad: BKL is not needed for ib_umad_open()
IB/uverbs: BKL is not needed for ib_uverbs_open()
bf561-coreb: BKL unneeded for open()
Call fasync() functions without the BKL
snd/PCM: fasync BKL pushdown
ipmi: fasync BKL pushdown
ecryptfs: fasync BKL pushdown
Bluetooth VHCI: fasync BKL pushdown
tty_io: fasync BKL pushdown
tun: fasync BKL pushdown
i2o: fasync BKL pushdown
mpt: fasync BKL pushdown
Remove BKL from remote_llseek v2
Make FAT users happier by not deadlocking
x86-mce: BKL pushdown
vmwatchdog: BKL pushdown
vmcp: BKL pushdown
via-pmu: BKL pushdown
uml-random: BKL pushdown
uml-mmapper: BKL pushdown
...
Diffstat (limited to 'fs')
-rw-r--r-- | fs/char_dev.c | 7 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 2 | ||||
-rw-r--r-- | fs/dlm/user.c | 9 | ||||
-rw-r--r-- | fs/ecryptfs/file.c | 3 | ||||
-rw-r--r-- | fs/fat/cache.c | 2 | ||||
-rw-r--r-- | fs/fat/dir.c | 4 | ||||
-rw-r--r-- | fs/fat/file.c | 6 | ||||
-rw-r--r-- | fs/fat/inode.c | 26 | ||||
-rw-r--r-- | fs/fcntl.c | 3 | ||||
-rw-r--r-- | fs/gfs2/ops_file.c | 4 | ||||
-rw-r--r-- | fs/msdos/namei.c | 35 | ||||
-rw-r--r-- | fs/ncpfs/file.c | 12 | ||||
-rw-r--r-- | fs/nfs/file.c | 6 | ||||
-rw-r--r-- | fs/ocfs2/stack_user.c | 3 | ||||
-rw-r--r-- | fs/read_write.c | 38 | ||||
-rw-r--r-- | fs/smbfs/file.c | 11 | ||||
-rw-r--r-- | fs/vfat/namei.c | 35 |
17 files changed, 114 insertions, 92 deletions
diff --git a/fs/char_dev.c b/fs/char_dev.c index 68e510b88457..3cb7cda3d780 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
@@ -373,6 +373,8 @@ static int chrdev_open(struct inode *inode, struct file *filp) | |||
373 | return -ENXIO; | 373 | return -ENXIO; |
374 | new = container_of(kobj, struct cdev, kobj); | 374 | new = container_of(kobj, struct cdev, kobj); |
375 | spin_lock(&cdev_lock); | 375 | spin_lock(&cdev_lock); |
376 | /* Check i_cdev again in case somebody beat us to it while | ||
377 | we dropped the lock. */ | ||
376 | p = inode->i_cdev; | 378 | p = inode->i_cdev; |
377 | if (!p) { | 379 | if (!p) { |
378 | inode->i_cdev = p = new; | 380 | inode->i_cdev = p = new; |
@@ -392,11 +394,8 @@ static int chrdev_open(struct inode *inode, struct file *filp) | |||
392 | cdev_put(p); | 394 | cdev_put(p); |
393 | return -ENXIO; | 395 | return -ENXIO; |
394 | } | 396 | } |
395 | if (filp->f_op->open) { | 397 | if (filp->f_op->open) |
396 | lock_kernel(); | ||
397 | ret = filp->f_op->open(inode,filp); | 398 | ret = filp->f_op->open(inode,filp); |
398 | unlock_kernel(); | ||
399 | } | ||
400 | if (ret) | 399 | if (ret) |
401 | cdev_put(p); | 400 | cdev_put(p); |
402 | return ret; | 401 | return ret; |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 86b4d5f405ae..22857c639df5 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -612,7 +612,7 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) | |||
612 | if (retval < 0) | 612 | if (retval < 0) |
613 | return (loff_t)retval; | 613 | return (loff_t)retval; |
614 | } | 614 | } |
615 | return remote_llseek(file, offset, origin); | 615 | return generic_file_llseek_unlocked(file, offset, origin); |
616 | } | 616 | } |
617 | 617 | ||
618 | struct file_system_type cifs_fs_type = { | 618 | struct file_system_type cifs_fs_type = { |
diff --git a/fs/dlm/user.c b/fs/dlm/user.c index ebbcf38fd33b..f976f303c196 100644 --- a/fs/dlm/user.c +++ b/fs/dlm/user.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/poll.h> | 15 | #include <linux/poll.h> |
16 | #include <linux/signal.h> | 16 | #include <linux/signal.h> |
17 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
18 | #include <linux/smp_lock.h> | ||
18 | #include <linux/dlm.h> | 19 | #include <linux/dlm.h> |
19 | #include <linux/dlm_device.h> | 20 | #include <linux/dlm_device.h> |
20 | 21 | ||
@@ -618,13 +619,17 @@ static int device_open(struct inode *inode, struct file *file) | |||
618 | struct dlm_user_proc *proc; | 619 | struct dlm_user_proc *proc; |
619 | struct dlm_ls *ls; | 620 | struct dlm_ls *ls; |
620 | 621 | ||
622 | lock_kernel(); | ||
621 | ls = dlm_find_lockspace_device(iminor(inode)); | 623 | ls = dlm_find_lockspace_device(iminor(inode)); |
622 | if (!ls) | 624 | if (!ls) { |
625 | unlock_kernel(); | ||
623 | return -ENOENT; | 626 | return -ENOENT; |
627 | } | ||
624 | 628 | ||
625 | proc = kzalloc(sizeof(struct dlm_user_proc), GFP_KERNEL); | 629 | proc = kzalloc(sizeof(struct dlm_user_proc), GFP_KERNEL); |
626 | if (!proc) { | 630 | if (!proc) { |
627 | dlm_put_lockspace(ls); | 631 | dlm_put_lockspace(ls); |
632 | unlock_kernel(); | ||
628 | return -ENOMEM; | 633 | return -ENOMEM; |
629 | } | 634 | } |
630 | 635 | ||
@@ -636,6 +641,7 @@ static int device_open(struct inode *inode, struct file *file) | |||
636 | spin_lock_init(&proc->locks_spin); | 641 | spin_lock_init(&proc->locks_spin); |
637 | init_waitqueue_head(&proc->wait); | 642 | init_waitqueue_head(&proc->wait); |
638 | file->private_data = proc; | 643 | file->private_data = proc; |
644 | unlock_kernel(); | ||
639 | 645 | ||
640 | return 0; | 646 | return 0; |
641 | } | 647 | } |
@@ -870,6 +876,7 @@ static unsigned int device_poll(struct file *file, poll_table *wait) | |||
870 | 876 | ||
871 | static int ctl_device_open(struct inode *inode, struct file *file) | 877 | static int ctl_device_open(struct inode *inode, struct file *file) |
872 | { | 878 | { |
879 | cycle_kernel_lock(); | ||
873 | file->private_data = NULL; | 880 | file->private_data = NULL; |
874 | return 0; | 881 | return 0; |
875 | } | 882 | } |
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index 2258b8f654a6..24749bf0668f 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/security.h> | 30 | #include <linux/security.h> |
31 | #include <linux/compat.h> | 31 | #include <linux/compat.h> |
32 | #include <linux/fs_stack.h> | 32 | #include <linux/fs_stack.h> |
33 | #include <linux/smp_lock.h> | ||
33 | #include "ecryptfs_kernel.h" | 34 | #include "ecryptfs_kernel.h" |
34 | 35 | ||
35 | /** | 36 | /** |
@@ -277,9 +278,11 @@ static int ecryptfs_fasync(int fd, struct file *file, int flag) | |||
277 | int rc = 0; | 278 | int rc = 0; |
278 | struct file *lower_file = NULL; | 279 | struct file *lower_file = NULL; |
279 | 280 | ||
281 | lock_kernel(); | ||
280 | lower_file = ecryptfs_file_to_lower(file); | 282 | lower_file = ecryptfs_file_to_lower(file); |
281 | if (lower_file->f_op && lower_file->f_op->fasync) | 283 | if (lower_file->f_op && lower_file->f_op->fasync) |
282 | rc = lower_file->f_op->fasync(fd, lower_file, flag); | 284 | rc = lower_file->f_op->fasync(fd, lower_file, flag); |
285 | unlock_kernel(); | ||
283 | return rc; | 286 | return rc; |
284 | } | 287 | } |
285 | 288 | ||
diff --git a/fs/fat/cache.c b/fs/fat/cache.c index fda25479af26..3a9ecac8d61f 100644 --- a/fs/fat/cache.c +++ b/fs/fat/cache.c | |||
@@ -61,7 +61,7 @@ void fat_cache_destroy(void) | |||
61 | 61 | ||
62 | static inline struct fat_cache *fat_cache_alloc(struct inode *inode) | 62 | static inline struct fat_cache *fat_cache_alloc(struct inode *inode) |
63 | { | 63 | { |
64 | return kmem_cache_alloc(fat_cache_cachep, GFP_KERNEL); | 64 | return kmem_cache_alloc(fat_cache_cachep, GFP_NOFS); |
65 | } | 65 | } |
66 | 66 | ||
67 | static inline void fat_cache_free(struct fat_cache *cache) | 67 | static inline void fat_cache_free(struct fat_cache *cache) |
diff --git a/fs/fat/dir.c b/fs/fat/dir.c index 486725ee99ae..34541d06e626 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c | |||
@@ -472,7 +472,7 @@ static int __fat_readdir(struct inode *inode, struct file *filp, void *dirent, | |||
472 | loff_t cpos; | 472 | loff_t cpos; |
473 | int ret = 0; | 473 | int ret = 0; |
474 | 474 | ||
475 | lock_kernel(); | 475 | lock_super(sb); |
476 | 476 | ||
477 | cpos = filp->f_pos; | 477 | cpos = filp->f_pos; |
478 | /* Fake . and .. for the root directory. */ | 478 | /* Fake . and .. for the root directory. */ |
@@ -654,7 +654,7 @@ FillFailed: | |||
654 | if (unicode) | 654 | if (unicode) |
655 | __putname(unicode); | 655 | __putname(unicode); |
656 | out: | 656 | out: |
657 | unlock_kernel(); | 657 | unlock_super(sb); |
658 | return ret; | 658 | return ret; |
659 | } | 659 | } |
660 | 660 | ||
diff --git a/fs/fat/file.c b/fs/fat/file.c index 771326b8047e..c672df4036e9 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/mount.h> | 11 | #include <linux/mount.h> |
12 | #include <linux/time.h> | 12 | #include <linux/time.h> |
13 | #include <linux/msdos_fs.h> | 13 | #include <linux/msdos_fs.h> |
14 | #include <linux/smp_lock.h> | ||
15 | #include <linux/buffer_head.h> | 14 | #include <linux/buffer_head.h> |
16 | #include <linux/writeback.h> | 15 | #include <linux/writeback.h> |
17 | #include <linux/backing-dev.h> | 16 | #include <linux/backing-dev.h> |
@@ -242,9 +241,7 @@ void fat_truncate(struct inode *inode) | |||
242 | 241 | ||
243 | nr_clusters = (inode->i_size + (cluster_size - 1)) >> sbi->cluster_bits; | 242 | nr_clusters = (inode->i_size + (cluster_size - 1)) >> sbi->cluster_bits; |
244 | 243 | ||
245 | lock_kernel(); | ||
246 | fat_free(inode, nr_clusters); | 244 | fat_free(inode, nr_clusters); |
247 | unlock_kernel(); | ||
248 | fat_flush_inodes(inode->i_sb, inode, NULL); | 245 | fat_flush_inodes(inode->i_sb, inode, NULL); |
249 | } | 246 | } |
250 | 247 | ||
@@ -310,8 +307,6 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr) | |||
310 | int error = 0; | 307 | int error = 0; |
311 | unsigned int ia_valid; | 308 | unsigned int ia_valid; |
312 | 309 | ||
313 | lock_kernel(); | ||
314 | |||
315 | /* | 310 | /* |
316 | * Expand the file. Since inode_setattr() updates ->i_size | 311 | * Expand the file. Since inode_setattr() updates ->i_size |
317 | * before calling the ->truncate(), but FAT needs to fill the | 312 | * before calling the ->truncate(), but FAT needs to fill the |
@@ -366,7 +361,6 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr) | |||
366 | 361 | ||
367 | error = inode_setattr(inode, attr); | 362 | error = inode_setattr(inode, attr); |
368 | out: | 363 | out: |
369 | unlock_kernel(); | ||
370 | return error; | 364 | return error; |
371 | } | 365 | } |
372 | EXPORT_SYMBOL_GPL(fat_setattr); | 366 | EXPORT_SYMBOL_GPL(fat_setattr); |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 4e0a3dd9d677..46a4508ffd2e 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -440,14 +440,13 @@ static void fat_delete_inode(struct inode *inode) | |||
440 | 440 | ||
441 | static void fat_clear_inode(struct inode *inode) | 441 | static void fat_clear_inode(struct inode *inode) |
442 | { | 442 | { |
443 | struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); | 443 | struct super_block *sb = inode->i_sb; |
444 | struct msdos_sb_info *sbi = MSDOS_SB(sb); | ||
444 | 445 | ||
445 | lock_kernel(); | ||
446 | spin_lock(&sbi->inode_hash_lock); | 446 | spin_lock(&sbi->inode_hash_lock); |
447 | fat_cache_inval_inode(inode); | 447 | fat_cache_inval_inode(inode); |
448 | hlist_del_init(&MSDOS_I(inode)->i_fat_hash); | 448 | hlist_del_init(&MSDOS_I(inode)->i_fat_hash); |
449 | spin_unlock(&sbi->inode_hash_lock); | 449 | spin_unlock(&sbi->inode_hash_lock); |
450 | unlock_kernel(); | ||
451 | } | 450 | } |
452 | 451 | ||
453 | static void fat_write_super(struct super_block *sb) | 452 | static void fat_write_super(struct super_block *sb) |
@@ -485,7 +484,7 @@ static struct kmem_cache *fat_inode_cachep; | |||
485 | static struct inode *fat_alloc_inode(struct super_block *sb) | 484 | static struct inode *fat_alloc_inode(struct super_block *sb) |
486 | { | 485 | { |
487 | struct msdos_inode_info *ei; | 486 | struct msdos_inode_info *ei; |
488 | ei = kmem_cache_alloc(fat_inode_cachep, GFP_KERNEL); | 487 | ei = kmem_cache_alloc(fat_inode_cachep, GFP_NOFS); |
489 | if (!ei) | 488 | if (!ei) |
490 | return NULL; | 489 | return NULL; |
491 | return &ei->vfs_inode; | 490 | return &ei->vfs_inode; |
@@ -567,7 +566,7 @@ retry: | |||
567 | if (inode->i_ino == MSDOS_ROOT_INO || !i_pos) | 566 | if (inode->i_ino == MSDOS_ROOT_INO || !i_pos) |
568 | return 0; | 567 | return 0; |
569 | 568 | ||
570 | lock_kernel(); | 569 | lock_super(sb); |
571 | bh = sb_bread(sb, i_pos >> sbi->dir_per_block_bits); | 570 | bh = sb_bread(sb, i_pos >> sbi->dir_per_block_bits); |
572 | if (!bh) { | 571 | if (!bh) { |
573 | printk(KERN_ERR "FAT: unable to read inode block " | 572 | printk(KERN_ERR "FAT: unable to read inode block " |
@@ -579,7 +578,7 @@ retry: | |||
579 | if (i_pos != MSDOS_I(inode)->i_pos) { | 578 | if (i_pos != MSDOS_I(inode)->i_pos) { |
580 | spin_unlock(&sbi->inode_hash_lock); | 579 | spin_unlock(&sbi->inode_hash_lock); |
581 | brelse(bh); | 580 | brelse(bh); |
582 | unlock_kernel(); | 581 | unlock_super(sb); |
583 | goto retry; | 582 | goto retry; |
584 | } | 583 | } |
585 | 584 | ||
@@ -606,7 +605,7 @@ retry: | |||
606 | err = sync_dirty_buffer(bh); | 605 | err = sync_dirty_buffer(bh); |
607 | brelse(bh); | 606 | brelse(bh); |
608 | out: | 607 | out: |
609 | unlock_kernel(); | 608 | unlock_super(sb); |
610 | return err; | 609 | return err; |
611 | } | 610 | } |
612 | 611 | ||
@@ -736,6 +735,7 @@ fat_encode_fh(struct dentry *de, __u32 *fh, int *lenp, int connectable) | |||
736 | 735 | ||
737 | static struct dentry *fat_get_parent(struct dentry *child) | 736 | static struct dentry *fat_get_parent(struct dentry *child) |
738 | { | 737 | { |
738 | struct super_block *sb = child->d_sb; | ||
739 | struct buffer_head *bh; | 739 | struct buffer_head *bh; |
740 | struct msdos_dir_entry *de; | 740 | struct msdos_dir_entry *de; |
741 | loff_t i_pos; | 741 | loff_t i_pos; |
@@ -743,14 +743,14 @@ static struct dentry *fat_get_parent(struct dentry *child) | |||
743 | struct inode *inode; | 743 | struct inode *inode; |
744 | int err; | 744 | int err; |
745 | 745 | ||
746 | lock_kernel(); | 746 | lock_super(sb); |
747 | 747 | ||
748 | err = fat_get_dotdot_entry(child->d_inode, &bh, &de, &i_pos); | 748 | err = fat_get_dotdot_entry(child->d_inode, &bh, &de, &i_pos); |
749 | if (err) { | 749 | if (err) { |
750 | parent = ERR_PTR(err); | 750 | parent = ERR_PTR(err); |
751 | goto out; | 751 | goto out; |
752 | } | 752 | } |
753 | inode = fat_build_inode(child->d_sb, de, i_pos); | 753 | inode = fat_build_inode(sb, de, i_pos); |
754 | brelse(bh); | 754 | brelse(bh); |
755 | if (IS_ERR(inode)) { | 755 | if (IS_ERR(inode)) { |
756 | parent = ERR_CAST(inode); | 756 | parent = ERR_CAST(inode); |
@@ -762,7 +762,7 @@ static struct dentry *fat_get_parent(struct dentry *child) | |||
762 | parent = ERR_PTR(-ENOMEM); | 762 | parent = ERR_PTR(-ENOMEM); |
763 | } | 763 | } |
764 | out: | 764 | out: |
765 | unlock_kernel(); | 765 | unlock_super(sb); |
766 | 766 | ||
767 | return parent; | 767 | return parent; |
768 | } | 768 | } |
@@ -1172,6 +1172,12 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, | |||
1172 | long error; | 1172 | long error; |
1173 | char buf[50]; | 1173 | char buf[50]; |
1174 | 1174 | ||
1175 | /* | ||
1176 | * GFP_KERNEL is ok here, because while we do hold the | ||
1177 | * supeblock lock, memory pressure can't call back into | ||
1178 | * the filesystem, since we're only just about to mount | ||
1179 | * it and have no inodes etc active! | ||
1180 | */ | ||
1175 | sbi = kzalloc(sizeof(struct msdos_sb_info), GFP_KERNEL); | 1181 | sbi = kzalloc(sizeof(struct msdos_sb_info), GFP_KERNEL); |
1176 | if (!sbi) | 1182 | if (!sbi) |
1177 | return -ENOMEM; | 1183 | return -ENOMEM; |
diff --git a/fs/fcntl.c b/fs/fcntl.c index bfd776509a72..330a7d782591 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/fdtable.h> | 12 | #include <linux/fdtable.h> |
13 | #include <linux/capability.h> | 13 | #include <linux/capability.h> |
14 | #include <linux/dnotify.h> | 14 | #include <linux/dnotify.h> |
15 | #include <linux/smp_lock.h> | ||
16 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
17 | #include <linux/module.h> | 16 | #include <linux/module.h> |
18 | #include <linux/security.h> | 17 | #include <linux/security.h> |
@@ -227,7 +226,6 @@ static int setfl(int fd, struct file * filp, unsigned long arg) | |||
227 | if (error) | 226 | if (error) |
228 | return error; | 227 | return error; |
229 | 228 | ||
230 | lock_kernel(); | ||
231 | if ((arg ^ filp->f_flags) & FASYNC) { | 229 | if ((arg ^ filp->f_flags) & FASYNC) { |
232 | if (filp->f_op && filp->f_op->fasync) { | 230 | if (filp->f_op && filp->f_op->fasync) { |
233 | error = filp->f_op->fasync(fd, filp, (arg & FASYNC) != 0); | 231 | error = filp->f_op->fasync(fd, filp, (arg & FASYNC) != 0); |
@@ -238,7 +236,6 @@ static int setfl(int fd, struct file * filp, unsigned long arg) | |||
238 | 236 | ||
239 | filp->f_flags = (arg & SETFL_MASK) | (filp->f_flags & ~SETFL_MASK); | 237 | filp->f_flags = (arg & SETFL_MASK) | (filp->f_flags & ~SETFL_MASK); |
240 | out: | 238 | out: |
241 | unlock_kernel(); | ||
242 | return error; | 239 | return error; |
243 | } | 240 | } |
244 | 241 | ||
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index e1b7d525a066..24dd59450088 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c | |||
@@ -62,11 +62,11 @@ static loff_t gfs2_llseek(struct file *file, loff_t offset, int origin) | |||
62 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, | 62 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, |
63 | &i_gh); | 63 | &i_gh); |
64 | if (!error) { | 64 | if (!error) { |
65 | error = remote_llseek(file, offset, origin); | 65 | error = generic_file_llseek_unlocked(file, offset, origin); |
66 | gfs2_glock_dq_uninit(&i_gh); | 66 | gfs2_glock_dq_uninit(&i_gh); |
67 | } | 67 | } |
68 | } else | 68 | } else |
69 | error = remote_llseek(file, offset, origin); | 69 | error = generic_file_llseek_unlocked(file, offset, origin); |
70 | 70 | ||
71 | return error; | 71 | return error; |
72 | } | 72 | } |
diff --git a/fs/msdos/namei.c b/fs/msdos/namei.c index 05ff4f1d7026..1f7f2956412a 100644 --- a/fs/msdos/namei.c +++ b/fs/msdos/namei.c | |||
@@ -214,7 +214,7 @@ static struct dentry *msdos_lookup(struct inode *dir, struct dentry *dentry, | |||
214 | 214 | ||
215 | dentry->d_op = &msdos_dentry_operations; | 215 | dentry->d_op = &msdos_dentry_operations; |
216 | 216 | ||
217 | lock_kernel(); | 217 | lock_super(sb); |
218 | res = msdos_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo); | 218 | res = msdos_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo); |
219 | if (res == -ENOENT) | 219 | if (res == -ENOENT) |
220 | goto add; | 220 | goto add; |
@@ -232,7 +232,7 @@ add: | |||
232 | if (dentry) | 232 | if (dentry) |
233 | dentry->d_op = &msdos_dentry_operations; | 233 | dentry->d_op = &msdos_dentry_operations; |
234 | out: | 234 | out: |
235 | unlock_kernel(); | 235 | unlock_super(sb); |
236 | if (!res) | 236 | if (!res) |
237 | return dentry; | 237 | return dentry; |
238 | return ERR_PTR(res); | 238 | return ERR_PTR(res); |
@@ -286,7 +286,7 @@ static int msdos_create(struct inode *dir, struct dentry *dentry, int mode, | |||
286 | unsigned char msdos_name[MSDOS_NAME]; | 286 | unsigned char msdos_name[MSDOS_NAME]; |
287 | int err, is_hid; | 287 | int err, is_hid; |
288 | 288 | ||
289 | lock_kernel(); | 289 | lock_super(sb); |
290 | 290 | ||
291 | err = msdos_format_name(dentry->d_name.name, dentry->d_name.len, | 291 | err = msdos_format_name(dentry->d_name.name, dentry->d_name.len, |
292 | msdos_name, &MSDOS_SB(sb)->options); | 292 | msdos_name, &MSDOS_SB(sb)->options); |
@@ -315,7 +315,7 @@ static int msdos_create(struct inode *dir, struct dentry *dentry, int mode, | |||
315 | 315 | ||
316 | d_instantiate(dentry, inode); | 316 | d_instantiate(dentry, inode); |
317 | out: | 317 | out: |
318 | unlock_kernel(); | 318 | unlock_super(sb); |
319 | if (!err) | 319 | if (!err) |
320 | err = fat_flush_inodes(sb, dir, inode); | 320 | err = fat_flush_inodes(sb, dir, inode); |
321 | return err; | 321 | return err; |
@@ -324,11 +324,12 @@ out: | |||
324 | /***** Remove a directory */ | 324 | /***** Remove a directory */ |
325 | static int msdos_rmdir(struct inode *dir, struct dentry *dentry) | 325 | static int msdos_rmdir(struct inode *dir, struct dentry *dentry) |
326 | { | 326 | { |
327 | struct super_block *sb = dir->i_sb; | ||
327 | struct inode *inode = dentry->d_inode; | 328 | struct inode *inode = dentry->d_inode; |
328 | struct fat_slot_info sinfo; | 329 | struct fat_slot_info sinfo; |
329 | int err; | 330 | int err; |
330 | 331 | ||
331 | lock_kernel(); | 332 | lock_super(sb); |
332 | /* | 333 | /* |
333 | * Check whether the directory is not in use, then check | 334 | * Check whether the directory is not in use, then check |
334 | * whether it is empty. | 335 | * whether it is empty. |
@@ -349,9 +350,9 @@ static int msdos_rmdir(struct inode *dir, struct dentry *dentry) | |||
349 | inode->i_ctime = CURRENT_TIME_SEC; | 350 | inode->i_ctime = CURRENT_TIME_SEC; |
350 | fat_detach(inode); | 351 | fat_detach(inode); |
351 | out: | 352 | out: |
352 | unlock_kernel(); | 353 | unlock_super(sb); |
353 | if (!err) | 354 | if (!err) |
354 | err = fat_flush_inodes(inode->i_sb, dir, inode); | 355 | err = fat_flush_inodes(sb, dir, inode); |
355 | 356 | ||
356 | return err; | 357 | return err; |
357 | } | 358 | } |
@@ -366,7 +367,7 @@ static int msdos_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
366 | struct timespec ts; | 367 | struct timespec ts; |
367 | int err, is_hid, cluster; | 368 | int err, is_hid, cluster; |
368 | 369 | ||
369 | lock_kernel(); | 370 | lock_super(sb); |
370 | 371 | ||
371 | err = msdos_format_name(dentry->d_name.name, dentry->d_name.len, | 372 | err = msdos_format_name(dentry->d_name.name, dentry->d_name.len, |
372 | msdos_name, &MSDOS_SB(sb)->options); | 373 | msdos_name, &MSDOS_SB(sb)->options); |
@@ -404,14 +405,14 @@ static int msdos_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
404 | 405 | ||
405 | d_instantiate(dentry, inode); | 406 | d_instantiate(dentry, inode); |
406 | 407 | ||
407 | unlock_kernel(); | 408 | unlock_super(sb); |
408 | fat_flush_inodes(sb, dir, inode); | 409 | fat_flush_inodes(sb, dir, inode); |
409 | return 0; | 410 | return 0; |
410 | 411 | ||
411 | out_free: | 412 | out_free: |
412 | fat_free_clusters(dir, cluster); | 413 | fat_free_clusters(dir, cluster); |
413 | out: | 414 | out: |
414 | unlock_kernel(); | 415 | unlock_super(sb); |
415 | return err; | 416 | return err; |
416 | } | 417 | } |
417 | 418 | ||
@@ -419,10 +420,11 @@ out: | |||
419 | static int msdos_unlink(struct inode *dir, struct dentry *dentry) | 420 | static int msdos_unlink(struct inode *dir, struct dentry *dentry) |
420 | { | 421 | { |
421 | struct inode *inode = dentry->d_inode; | 422 | struct inode *inode = dentry->d_inode; |
423 | struct super_block *sb= inode->i_sb; | ||
422 | struct fat_slot_info sinfo; | 424 | struct fat_slot_info sinfo; |
423 | int err; | 425 | int err; |
424 | 426 | ||
425 | lock_kernel(); | 427 | lock_super(sb); |
426 | err = msdos_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo); | 428 | err = msdos_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo); |
427 | if (err) | 429 | if (err) |
428 | goto out; | 430 | goto out; |
@@ -434,9 +436,9 @@ static int msdos_unlink(struct inode *dir, struct dentry *dentry) | |||
434 | inode->i_ctime = CURRENT_TIME_SEC; | 436 | inode->i_ctime = CURRENT_TIME_SEC; |
435 | fat_detach(inode); | 437 | fat_detach(inode); |
436 | out: | 438 | out: |
437 | unlock_kernel(); | 439 | unlock_super(sb); |
438 | if (!err) | 440 | if (!err) |
439 | err = fat_flush_inodes(inode->i_sb, dir, inode); | 441 | err = fat_flush_inodes(sb, dir, inode); |
440 | 442 | ||
441 | return err; | 443 | return err; |
442 | } | 444 | } |
@@ -618,10 +620,11 @@ error_inode: | |||
618 | static int msdos_rename(struct inode *old_dir, struct dentry *old_dentry, | 620 | static int msdos_rename(struct inode *old_dir, struct dentry *old_dentry, |
619 | struct inode *new_dir, struct dentry *new_dentry) | 621 | struct inode *new_dir, struct dentry *new_dentry) |
620 | { | 622 | { |
623 | struct super_block *sb = old_dir->i_sb; | ||
621 | unsigned char old_msdos_name[MSDOS_NAME], new_msdos_name[MSDOS_NAME]; | 624 | unsigned char old_msdos_name[MSDOS_NAME], new_msdos_name[MSDOS_NAME]; |
622 | int err, is_hid; | 625 | int err, is_hid; |
623 | 626 | ||
624 | lock_kernel(); | 627 | lock_super(sb); |
625 | 628 | ||
626 | err = msdos_format_name(old_dentry->d_name.name, | 629 | err = msdos_format_name(old_dentry->d_name.name, |
627 | old_dentry->d_name.len, old_msdos_name, | 630 | old_dentry->d_name.len, old_msdos_name, |
@@ -640,9 +643,9 @@ static int msdos_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
640 | err = do_msdos_rename(old_dir, old_msdos_name, old_dentry, | 643 | err = do_msdos_rename(old_dir, old_msdos_name, old_dentry, |
641 | new_dir, new_msdos_name, new_dentry, is_hid); | 644 | new_dir, new_msdos_name, new_dentry, is_hid); |
642 | out: | 645 | out: |
643 | unlock_kernel(); | 646 | unlock_super(sb); |
644 | if (!err) | 647 | if (!err) |
645 | err = fat_flush_inodes(old_dir->i_sb, old_dir, new_dir); | 648 | err = fat_flush_inodes(sb, old_dir, new_dir); |
646 | return err; | 649 | return err; |
647 | } | 650 | } |
648 | 651 | ||
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c index 2b145de45b39..6a7d901f1936 100644 --- a/fs/ncpfs/file.c +++ b/fs/ncpfs/file.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/vmalloc.h> | 19 | #include <linux/vmalloc.h> |
20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
21 | #include <linux/smp_lock.h> | ||
21 | 22 | ||
22 | #include <linux/ncp_fs.h> | 23 | #include <linux/ncp_fs.h> |
23 | #include "ncplib_kernel.h" | 24 | #include "ncplib_kernel.h" |
@@ -281,9 +282,18 @@ static int ncp_release(struct inode *inode, struct file *file) { | |||
281 | return 0; | 282 | return 0; |
282 | } | 283 | } |
283 | 284 | ||
285 | static loff_t ncp_remote_llseek(struct file *file, loff_t offset, int origin) | ||
286 | { | ||
287 | loff_t ret; | ||
288 | lock_kernel(); | ||
289 | ret = generic_file_llseek_unlocked(file, offset, origin); | ||
290 | unlock_kernel(); | ||
291 | return ret; | ||
292 | } | ||
293 | |||
284 | const struct file_operations ncp_file_operations = | 294 | const struct file_operations ncp_file_operations = |
285 | { | 295 | { |
286 | .llseek = remote_llseek, | 296 | .llseek = ncp_remote_llseek, |
287 | .read = ncp_file_read, | 297 | .read = ncp_file_read, |
288 | .write = ncp_file_write, | 298 | .write = ncp_file_write, |
289 | .ioctl = ncp_ioctl, | 299 | .ioctl = ncp_ioctl, |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index d84a3d8f32af..4e98a56a1777 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -170,6 +170,7 @@ force_reval: | |||
170 | 170 | ||
171 | static loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin) | 171 | static loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin) |
172 | { | 172 | { |
173 | loff_t loff; | ||
173 | /* origin == SEEK_END => we must revalidate the cached file length */ | 174 | /* origin == SEEK_END => we must revalidate the cached file length */ |
174 | if (origin == SEEK_END) { | 175 | if (origin == SEEK_END) { |
175 | struct inode *inode = filp->f_mapping->host; | 176 | struct inode *inode = filp->f_mapping->host; |
@@ -177,7 +178,10 @@ static loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin) | |||
177 | if (retval < 0) | 178 | if (retval < 0) |
178 | return (loff_t)retval; | 179 | return (loff_t)retval; |
179 | } | 180 | } |
180 | return remote_llseek(filp, offset, origin); | 181 | lock_kernel(); /* BKL needed? */ |
182 | loff = generic_file_llseek_unlocked(filp, offset, origin); | ||
183 | unlock_kernel(); | ||
184 | return loff; | ||
181 | } | 185 | } |
182 | 186 | ||
183 | /* | 187 | /* |
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c index c021280dd462..bd7e0f3acfc7 100644 --- a/fs/ocfs2/stack_user.c +++ b/fs/ocfs2/stack_user.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/miscdevice.h> | 22 | #include <linux/miscdevice.h> |
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/smp_lock.h> | ||
24 | #include <linux/reboot.h> | 25 | #include <linux/reboot.h> |
25 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
26 | 27 | ||
@@ -619,10 +620,12 @@ static int ocfs2_control_open(struct inode *inode, struct file *file) | |||
619 | return -ENOMEM; | 620 | return -ENOMEM; |
620 | p->op_this_node = -1; | 621 | p->op_this_node = -1; |
621 | 622 | ||
623 | lock_kernel(); | ||
622 | mutex_lock(&ocfs2_control_lock); | 624 | mutex_lock(&ocfs2_control_lock); |
623 | file->private_data = p; | 625 | file->private_data = p; |
624 | list_add(&p->op_list, &ocfs2_control_private_list); | 626 | list_add(&p->op_list, &ocfs2_control_private_list); |
625 | mutex_unlock(&ocfs2_control_lock); | 627 | mutex_unlock(&ocfs2_control_lock); |
628 | unlock_kernel(); | ||
626 | 629 | ||
627 | return 0; | 630 | return 0; |
628 | } | 631 | } |
diff --git a/fs/read_write.c b/fs/read_write.c index f0d1240a5c69..9ba495d5a29b 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -31,12 +31,12 @@ const struct file_operations generic_ro_fops = { | |||
31 | 31 | ||
32 | EXPORT_SYMBOL(generic_ro_fops); | 32 | EXPORT_SYMBOL(generic_ro_fops); |
33 | 33 | ||
34 | loff_t generic_file_llseek(struct file *file, loff_t offset, int origin) | 34 | loff_t |
35 | generic_file_llseek_unlocked(struct file *file, loff_t offset, int origin) | ||
35 | { | 36 | { |
36 | loff_t retval; | 37 | loff_t retval; |
37 | struct inode *inode = file->f_mapping->host; | 38 | struct inode *inode = file->f_mapping->host; |
38 | 39 | ||
39 | mutex_lock(&inode->i_mutex); | ||
40 | switch (origin) { | 40 | switch (origin) { |
41 | case SEEK_END: | 41 | case SEEK_END: |
42 | offset += inode->i_size; | 42 | offset += inode->i_size; |
@@ -46,42 +46,26 @@ loff_t generic_file_llseek(struct file *file, loff_t offset, int origin) | |||
46 | } | 46 | } |
47 | retval = -EINVAL; | 47 | retval = -EINVAL; |
48 | if (offset>=0 && offset<=inode->i_sb->s_maxbytes) { | 48 | if (offset>=0 && offset<=inode->i_sb->s_maxbytes) { |
49 | /* Special lock needed here? */ | ||
49 | if (offset != file->f_pos) { | 50 | if (offset != file->f_pos) { |
50 | file->f_pos = offset; | 51 | file->f_pos = offset; |
51 | file->f_version = 0; | 52 | file->f_version = 0; |
52 | } | 53 | } |
53 | retval = offset; | 54 | retval = offset; |
54 | } | 55 | } |
55 | mutex_unlock(&inode->i_mutex); | ||
56 | return retval; | 56 | return retval; |
57 | } | 57 | } |
58 | EXPORT_SYMBOL(generic_file_llseek_unlocked); | ||
58 | 59 | ||
59 | EXPORT_SYMBOL(generic_file_llseek); | 60 | loff_t generic_file_llseek(struct file *file, loff_t offset, int origin) |
60 | |||
61 | loff_t remote_llseek(struct file *file, loff_t offset, int origin) | ||
62 | { | 61 | { |
63 | loff_t retval; | 62 | loff_t n; |
64 | 63 | mutex_lock(&file->f_dentry->d_inode->i_mutex); | |
65 | lock_kernel(); | 64 | n = generic_file_llseek_unlocked(file, offset, origin); |
66 | switch (origin) { | 65 | mutex_unlock(&file->f_dentry->d_inode->i_mutex); |
67 | case SEEK_END: | 66 | return n; |
68 | offset += i_size_read(file->f_path.dentry->d_inode); | ||
69 | break; | ||
70 | case SEEK_CUR: | ||
71 | offset += file->f_pos; | ||
72 | } | ||
73 | retval = -EINVAL; | ||
74 | if (offset>=0 && offset<=file->f_path.dentry->d_inode->i_sb->s_maxbytes) { | ||
75 | if (offset != file->f_pos) { | ||
76 | file->f_pos = offset; | ||
77 | file->f_version = 0; | ||
78 | } | ||
79 | retval = offset; | ||
80 | } | ||
81 | unlock_kernel(); | ||
82 | return retval; | ||
83 | } | 67 | } |
84 | EXPORT_SYMBOL(remote_llseek); | 68 | EXPORT_SYMBOL(generic_file_llseek); |
85 | 69 | ||
86 | loff_t no_llseek(struct file *file, loff_t offset, int origin) | 70 | loff_t no_llseek(struct file *file, loff_t offset, int origin) |
87 | { | 71 | { |
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c index efbe29af3d7a..2294783320cb 100644 --- a/fs/smbfs/file.c +++ b/fs/smbfs/file.c | |||
@@ -422,9 +422,18 @@ smb_file_permission(struct inode *inode, int mask, struct nameidata *nd) | |||
422 | return error; | 422 | return error; |
423 | } | 423 | } |
424 | 424 | ||
425 | static loff_t smb_remote_llseek(struct file *file, loff_t offset, int origin) | ||
426 | { | ||
427 | loff_t ret; | ||
428 | lock_kernel(); | ||
429 | ret = generic_file_llseek_unlocked(file, offset, origin); | ||
430 | unlock_kernel(); | ||
431 | return ret; | ||
432 | } | ||
433 | |||
425 | const struct file_operations smb_file_operations = | 434 | const struct file_operations smb_file_operations = |
426 | { | 435 | { |
427 | .llseek = remote_llseek, | 436 | .llseek = smb_remote_llseek, |
428 | .read = do_sync_read, | 437 | .read = do_sync_read, |
429 | .aio_read = smb_file_aio_read, | 438 | .aio_read = smb_file_aio_read, |
430 | .write = do_sync_write, | 439 | .write = do_sync_write, |
diff --git a/fs/vfat/namei.c b/fs/vfat/namei.c index a3522727ea5b..b546ba69be82 100644 --- a/fs/vfat/namei.c +++ b/fs/vfat/namei.c | |||
@@ -645,7 +645,7 @@ static int vfat_add_entry(struct inode *dir, struct qstr *qname, int is_dir, | |||
645 | if (len == 0) | 645 | if (len == 0) |
646 | return -ENOENT; | 646 | return -ENOENT; |
647 | 647 | ||
648 | slots = kmalloc(sizeof(*slots) * MSDOS_SLOTS, GFP_KERNEL); | 648 | slots = kmalloc(sizeof(*slots) * MSDOS_SLOTS, GFP_NOFS); |
649 | if (slots == NULL) | 649 | if (slots == NULL) |
650 | return -ENOMEM; | 650 | return -ENOMEM; |
651 | 651 | ||
@@ -687,7 +687,7 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry, | |||
687 | struct dentry *alias; | 687 | struct dentry *alias; |
688 | int err, table; | 688 | int err, table; |
689 | 689 | ||
690 | lock_kernel(); | 690 | lock_super(sb); |
691 | table = (MSDOS_SB(sb)->options.name_check == 's') ? 2 : 0; | 691 | table = (MSDOS_SB(sb)->options.name_check == 's') ? 2 : 0; |
692 | dentry->d_op = &vfat_dentry_ops[table]; | 692 | dentry->d_op = &vfat_dentry_ops[table]; |
693 | 693 | ||
@@ -699,7 +699,7 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry, | |||
699 | inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos); | 699 | inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos); |
700 | brelse(sinfo.bh); | 700 | brelse(sinfo.bh); |
701 | if (IS_ERR(inode)) { | 701 | if (IS_ERR(inode)) { |
702 | unlock_kernel(); | 702 | unlock_super(sb); |
703 | return ERR_CAST(inode); | 703 | return ERR_CAST(inode); |
704 | } | 704 | } |
705 | alias = d_find_alias(inode); | 705 | alias = d_find_alias(inode); |
@@ -708,13 +708,13 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry, | |||
708 | dput(alias); | 708 | dput(alias); |
709 | else { | 709 | else { |
710 | iput(inode); | 710 | iput(inode); |
711 | unlock_kernel(); | 711 | unlock_super(sb); |
712 | return alias; | 712 | return alias; |
713 | } | 713 | } |
714 | 714 | ||
715 | } | 715 | } |
716 | error: | 716 | error: |
717 | unlock_kernel(); | 717 | unlock_super(sb); |
718 | dentry->d_op = &vfat_dentry_ops[table]; | 718 | dentry->d_op = &vfat_dentry_ops[table]; |
719 | dentry->d_time = dentry->d_parent->d_inode->i_version; | 719 | dentry->d_time = dentry->d_parent->d_inode->i_version; |
720 | dentry = d_splice_alias(inode, dentry); | 720 | dentry = d_splice_alias(inode, dentry); |
@@ -734,7 +734,7 @@ static int vfat_create(struct inode *dir, struct dentry *dentry, int mode, | |||
734 | struct timespec ts; | 734 | struct timespec ts; |
735 | int err; | 735 | int err; |
736 | 736 | ||
737 | lock_kernel(); | 737 | lock_super(sb); |
738 | 738 | ||
739 | ts = CURRENT_TIME_SEC; | 739 | ts = CURRENT_TIME_SEC; |
740 | err = vfat_add_entry(dir, &dentry->d_name, 0, 0, &ts, &sinfo); | 740 | err = vfat_add_entry(dir, &dentry->d_name, 0, 0, &ts, &sinfo); |
@@ -755,17 +755,18 @@ static int vfat_create(struct inode *dir, struct dentry *dentry, int mode, | |||
755 | dentry->d_time = dentry->d_parent->d_inode->i_version; | 755 | dentry->d_time = dentry->d_parent->d_inode->i_version; |
756 | d_instantiate(dentry, inode); | 756 | d_instantiate(dentry, inode); |
757 | out: | 757 | out: |
758 | unlock_kernel(); | 758 | unlock_super(sb); |
759 | return err; | 759 | return err; |
760 | } | 760 | } |
761 | 761 | ||
762 | static int vfat_rmdir(struct inode *dir, struct dentry *dentry) | 762 | static int vfat_rmdir(struct inode *dir, struct dentry *dentry) |
763 | { | 763 | { |
764 | struct inode *inode = dentry->d_inode; | 764 | struct inode *inode = dentry->d_inode; |
765 | struct super_block *sb = dir->i_sb; | ||
765 | struct fat_slot_info sinfo; | 766 | struct fat_slot_info sinfo; |
766 | int err; | 767 | int err; |
767 | 768 | ||
768 | lock_kernel(); | 769 | lock_super(sb); |
769 | 770 | ||
770 | err = fat_dir_empty(inode); | 771 | err = fat_dir_empty(inode); |
771 | if (err) | 772 | if (err) |
@@ -783,7 +784,7 @@ static int vfat_rmdir(struct inode *dir, struct dentry *dentry) | |||
783 | inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC; | 784 | inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC; |
784 | fat_detach(inode); | 785 | fat_detach(inode); |
785 | out: | 786 | out: |
786 | unlock_kernel(); | 787 | unlock_super(sb); |
787 | 788 | ||
788 | return err; | 789 | return err; |
789 | } | 790 | } |
@@ -791,10 +792,11 @@ out: | |||
791 | static int vfat_unlink(struct inode *dir, struct dentry *dentry) | 792 | static int vfat_unlink(struct inode *dir, struct dentry *dentry) |
792 | { | 793 | { |
793 | struct inode *inode = dentry->d_inode; | 794 | struct inode *inode = dentry->d_inode; |
795 | struct super_block *sb = dir->i_sb; | ||
794 | struct fat_slot_info sinfo; | 796 | struct fat_slot_info sinfo; |
795 | int err; | 797 | int err; |
796 | 798 | ||
797 | lock_kernel(); | 799 | lock_super(sb); |
798 | 800 | ||
799 | err = vfat_find(dir, &dentry->d_name, &sinfo); | 801 | err = vfat_find(dir, &dentry->d_name, &sinfo); |
800 | if (err) | 802 | if (err) |
@@ -807,7 +809,7 @@ static int vfat_unlink(struct inode *dir, struct dentry *dentry) | |||
807 | inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC; | 809 | inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC; |
808 | fat_detach(inode); | 810 | fat_detach(inode); |
809 | out: | 811 | out: |
810 | unlock_kernel(); | 812 | unlock_super(sb); |
811 | 813 | ||
812 | return err; | 814 | return err; |
813 | } | 815 | } |
@@ -820,7 +822,7 @@ static int vfat_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
820 | struct timespec ts; | 822 | struct timespec ts; |
821 | int err, cluster; | 823 | int err, cluster; |
822 | 824 | ||
823 | lock_kernel(); | 825 | lock_super(sb); |
824 | 826 | ||
825 | ts = CURRENT_TIME_SEC; | 827 | ts = CURRENT_TIME_SEC; |
826 | cluster = fat_alloc_new_dir(dir, &ts); | 828 | cluster = fat_alloc_new_dir(dir, &ts); |
@@ -849,13 +851,13 @@ static int vfat_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
849 | dentry->d_time = dentry->d_parent->d_inode->i_version; | 851 | dentry->d_time = dentry->d_parent->d_inode->i_version; |
850 | d_instantiate(dentry, inode); | 852 | d_instantiate(dentry, inode); |
851 | 853 | ||
852 | unlock_kernel(); | 854 | unlock_super(sb); |
853 | return 0; | 855 | return 0; |
854 | 856 | ||
855 | out_free: | 857 | out_free: |
856 | fat_free_clusters(dir, cluster); | 858 | fat_free_clusters(dir, cluster); |
857 | out: | 859 | out: |
858 | unlock_kernel(); | 860 | unlock_super(sb); |
859 | return err; | 861 | return err; |
860 | } | 862 | } |
861 | 863 | ||
@@ -869,11 +871,12 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
869 | struct timespec ts; | 871 | struct timespec ts; |
870 | loff_t dotdot_i_pos, new_i_pos; | 872 | loff_t dotdot_i_pos, new_i_pos; |
871 | int err, is_dir, update_dotdot, corrupt = 0; | 873 | int err, is_dir, update_dotdot, corrupt = 0; |
874 | struct super_block *sb = old_dir->i_sb; | ||
872 | 875 | ||
873 | old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; | 876 | old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; |
874 | old_inode = old_dentry->d_inode; | 877 | old_inode = old_dentry->d_inode; |
875 | new_inode = new_dentry->d_inode; | 878 | new_inode = new_dentry->d_inode; |
876 | lock_kernel(); | 879 | lock_super(sb); |
877 | err = vfat_find(old_dir, &old_dentry->d_name, &old_sinfo); | 880 | err = vfat_find(old_dir, &old_dentry->d_name, &old_sinfo); |
878 | if (err) | 881 | if (err) |
879 | goto out; | 882 | goto out; |
@@ -951,7 +954,7 @@ out: | |||
951 | brelse(sinfo.bh); | 954 | brelse(sinfo.bh); |
952 | brelse(dotdot_bh); | 955 | brelse(dotdot_bh); |
953 | brelse(old_sinfo.bh); | 956 | brelse(old_sinfo.bh); |
954 | unlock_kernel(); | 957 | unlock_super(sb); |
955 | 958 | ||
956 | return err; | 959 | return err; |
957 | 960 | ||