diff options
Diffstat (limited to 'fs/fat')
-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 |
4 files changed, 19 insertions, 19 deletions
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; |