diff options
author | Christoph Hellwig <hch@lst.de> | 2009-05-05 09:40:36 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-06-11 21:36:07 -0400 |
commit | 6cfd0148425e528b859b26e436b01f23f6926224 (patch) | |
tree | 60e3257053554ff198fe5825e6f12a00c3b4422a | |
parent | a9e220f8322e2b0e0b8903fe00265461cffad3f0 (diff) |
push BKL down into ->put_super
Move BKL into ->put_super from the only caller. A couple of
filesystems had trivial enough ->put_super (only kfree and NULLing of
s_fs_info + stuff in there) to not get any locking: coda, cramfs, efs,
hugetlbfs, omfs, qnx4, shmem, all others got the full treatment. Most
of them probably don't need it, but I'd rather sort that out individually.
Preferably after all the other BKL pushdowns in that area.
[AV: original used to move lock_super() down as well; these changes are
removed since we don't do lock_super() at all in generic_shutdown_super()
now]
[AV: fuse, btrfs and xfs are known to need no damn BKL, exempt]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/adfs/super.c | 4 | ||||
-rw-r--r-- | fs/affs/super.c | 5 | ||||
-rw-r--r-- | fs/afs/super.c | 4 | ||||
-rw-r--r-- | fs/befs/linuxvfs.c | 5 | ||||
-rw-r--r-- | fs/bfs/inode.c | 4 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 6 | ||||
-rw-r--r-- | fs/ecryptfs/super.c | 5 | ||||
-rw-r--r-- | fs/exofs/super.c | 4 | ||||
-rw-r--r-- | fs/ext2/super.c | 4 | ||||
-rw-r--r-- | fs/ext3/super.c | 5 | ||||
-rw-r--r-- | fs/ext4/super.c | 2 | ||||
-rw-r--r-- | fs/fat/inode.c | 4 | ||||
-rw-r--r-- | fs/freevxfs/vxfs_super.c | 4 | ||||
-rw-r--r-- | fs/gfs2/super.c | 4 | ||||
-rw-r--r-- | fs/hfs/super.c | 4 | ||||
-rw-r--r-- | fs/hfsplus/super.c | 5 | ||||
-rw-r--r-- | fs/hpfs/super.c | 5 | ||||
-rw-r--r-- | fs/isofs/inode.c | 5 | ||||
-rw-r--r-- | fs/jffs2/super.c | 4 | ||||
-rw-r--r-- | fs/jfs/super.c | 5 | ||||
-rw-r--r-- | fs/minix/inode.c | 4 | ||||
-rw-r--r-- | fs/ncpfs/inode.c | 4 | ||||
-rw-r--r-- | fs/nilfs2/super.c | 4 | ||||
-rw-r--r-- | fs/ntfs/super.c | 6 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 4 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 4 | ||||
-rw-r--r-- | fs/smbfs/inode.c | 4 | ||||
-rw-r--r-- | fs/squashfs/super.c | 4 | ||||
-rw-r--r-- | fs/super.c | 3 | ||||
-rw-r--r-- | fs/sysv/inode.c | 4 | ||||
-rw-r--r-- | fs/ubifs/super.c | 5 | ||||
-rw-r--r-- | fs/udf/super.c | 5 | ||||
-rw-r--r-- | fs/ufs/super.c | 6 |
33 files changed, 133 insertions, 12 deletions
diff --git a/fs/adfs/super.c b/fs/adfs/super.c index dd9becca4241..0ec5aaf47aa7 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c | |||
@@ -132,11 +132,15 @@ static void adfs_put_super(struct super_block *sb) | |||
132 | int i; | 132 | int i; |
133 | struct adfs_sb_info *asb = ADFS_SB(sb); | 133 | struct adfs_sb_info *asb = ADFS_SB(sb); |
134 | 134 | ||
135 | lock_kernel(); | ||
136 | |||
135 | for (i = 0; i < asb->s_map_size; i++) | 137 | for (i = 0; i < asb->s_map_size; i++) |
136 | brelse(asb->s_map[i].dm_bh); | 138 | brelse(asb->s_map[i].dm_bh); |
137 | kfree(asb->s_map); | 139 | kfree(asb->s_map); |
138 | kfree(asb); | 140 | kfree(asb); |
139 | sb->s_fs_info = NULL; | 141 | sb->s_fs_info = NULL; |
142 | |||
143 | unlock_kernel(); | ||
140 | } | 144 | } |
141 | 145 | ||
142 | static int adfs_show_options(struct seq_file *seq, struct vfsmount *mnt) | 146 | static int adfs_show_options(struct seq_file *seq, struct vfsmount *mnt) |
diff --git a/fs/affs/super.c b/fs/affs/super.c index 63f5183f263b..d7386462a8e7 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
@@ -29,6 +29,8 @@ affs_put_super(struct super_block *sb) | |||
29 | struct affs_sb_info *sbi = AFFS_SB(sb); | 29 | struct affs_sb_info *sbi = AFFS_SB(sb); |
30 | pr_debug("AFFS: put_super()\n"); | 30 | pr_debug("AFFS: put_super()\n"); |
31 | 31 | ||
32 | lock_kernel(); | ||
33 | |||
32 | if (!(sb->s_flags & MS_RDONLY)) { | 34 | if (!(sb->s_flags & MS_RDONLY)) { |
33 | AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = cpu_to_be32(1); | 35 | AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = cpu_to_be32(1); |
34 | secs_to_datestamp(get_seconds(), | 36 | secs_to_datestamp(get_seconds(), |
@@ -42,7 +44,8 @@ affs_put_super(struct super_block *sb) | |||
42 | affs_brelse(sbi->s_root_bh); | 44 | affs_brelse(sbi->s_root_bh); |
43 | kfree(sbi); | 45 | kfree(sbi); |
44 | sb->s_fs_info = NULL; | 46 | sb->s_fs_info = NULL; |
45 | return; | 47 | |
48 | unlock_kernel(); | ||
46 | } | 49 | } |
47 | 50 | ||
48 | static void | 51 | static void |
diff --git a/fs/afs/super.c b/fs/afs/super.c index 76828e5f8a39..ad0514d0115f 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c | |||
@@ -440,8 +440,12 @@ static void afs_put_super(struct super_block *sb) | |||
440 | 440 | ||
441 | _enter(""); | 441 | _enter(""); |
442 | 442 | ||
443 | lock_kernel(); | ||
444 | |||
443 | afs_put_volume(as->volume); | 445 | afs_put_volume(as->volume); |
444 | 446 | ||
447 | unlock_kernel(); | ||
448 | |||
445 | _leave(""); | 449 | _leave(""); |
446 | } | 450 | } |
447 | 451 | ||
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 76afd0d6b86c..9367b6297d84 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c | |||
@@ -737,6 +737,8 @@ parse_options(char *options, befs_mount_options * opts) | |||
737 | static void | 737 | static void |
738 | befs_put_super(struct super_block *sb) | 738 | befs_put_super(struct super_block *sb) |
739 | { | 739 | { |
740 | lock_kernel(); | ||
741 | |||
740 | kfree(BEFS_SB(sb)->mount_opts.iocharset); | 742 | kfree(BEFS_SB(sb)->mount_opts.iocharset); |
741 | BEFS_SB(sb)->mount_opts.iocharset = NULL; | 743 | BEFS_SB(sb)->mount_opts.iocharset = NULL; |
742 | 744 | ||
@@ -747,7 +749,8 @@ befs_put_super(struct super_block *sb) | |||
747 | 749 | ||
748 | kfree(sb->s_fs_info); | 750 | kfree(sb->s_fs_info); |
749 | sb->s_fs_info = NULL; | 751 | sb->s_fs_info = NULL; |
750 | return; | 752 | |
753 | unlock_kernel(); | ||
751 | } | 754 | } |
752 | 755 | ||
753 | /* Allocate private field of the superblock, fill it. | 756 | /* Allocate private field of the superblock, fill it. |
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index 4cf3d269e271..3a9a1361fdc1 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c | |||
@@ -217,6 +217,8 @@ static void bfs_put_super(struct super_block *s) | |||
217 | if (!info) | 217 | if (!info) |
218 | return; | 218 | return; |
219 | 219 | ||
220 | lock_kernel(); | ||
221 | |||
220 | if (s->s_dirt) | 222 | if (s->s_dirt) |
221 | bfs_write_super(s); | 223 | bfs_write_super(s); |
222 | 224 | ||
@@ -225,6 +227,8 @@ static void bfs_put_super(struct super_block *s) | |||
225 | kfree(info->si_imap); | 227 | kfree(info->si_imap); |
226 | kfree(info); | 228 | kfree(info); |
227 | s->s_fs_info = NULL; | 229 | s->s_fs_info = NULL; |
230 | |||
231 | unlock_kernel(); | ||
228 | } | 232 | } |
229 | 233 | ||
230 | static int bfs_statfs(struct dentry *dentry, struct kstatfs *buf) | 234 | static int bfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 0a10a59b6392..0d92114195ab 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -204,6 +204,9 @@ cifs_put_super(struct super_block *sb) | |||
204 | cFYI(1, ("Empty cifs superblock info passed to unmount")); | 204 | cFYI(1, ("Empty cifs superblock info passed to unmount")); |
205 | return; | 205 | return; |
206 | } | 206 | } |
207 | |||
208 | lock_kernel(); | ||
209 | |||
207 | rc = cifs_umount(sb, cifs_sb); | 210 | rc = cifs_umount(sb, cifs_sb); |
208 | if (rc) | 211 | if (rc) |
209 | cERROR(1, ("cifs_umount failed with return code %d", rc)); | 212 | cERROR(1, ("cifs_umount failed with return code %d", rc)); |
@@ -216,7 +219,8 @@ cifs_put_super(struct super_block *sb) | |||
216 | 219 | ||
217 | unload_nls(cifs_sb->local_nls); | 220 | unload_nls(cifs_sb->local_nls); |
218 | kfree(cifs_sb); | 221 | kfree(cifs_sb); |
219 | return; | 222 | |
223 | unlock_kernel(); | ||
220 | } | 224 | } |
221 | 225 | ||
222 | static int | 226 | static int |
diff --git a/fs/ecryptfs/super.c b/fs/ecryptfs/super.c index fa4c7e7d15d9..12d649602d3a 100644 --- a/fs/ecryptfs/super.c +++ b/fs/ecryptfs/super.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/mount.h> | 27 | #include <linux/mount.h> |
28 | #include <linux/key.h> | 28 | #include <linux/key.h> |
29 | #include <linux/seq_file.h> | 29 | #include <linux/seq_file.h> |
30 | #include <linux/smp_lock.h> | ||
30 | #include <linux/file.h> | 31 | #include <linux/file.h> |
31 | #include <linux/crypto.h> | 32 | #include <linux/crypto.h> |
32 | #include "ecryptfs_kernel.h" | 33 | #include "ecryptfs_kernel.h" |
@@ -120,9 +121,13 @@ static void ecryptfs_put_super(struct super_block *sb) | |||
120 | { | 121 | { |
121 | struct ecryptfs_sb_info *sb_info = ecryptfs_superblock_to_private(sb); | 122 | struct ecryptfs_sb_info *sb_info = ecryptfs_superblock_to_private(sb); |
122 | 123 | ||
124 | lock_kernel(); | ||
125 | |||
123 | ecryptfs_destroy_mount_crypt_stat(&sb_info->mount_crypt_stat); | 126 | ecryptfs_destroy_mount_crypt_stat(&sb_info->mount_crypt_stat); |
124 | kmem_cache_free(ecryptfs_sb_info_cache, sb_info); | 127 | kmem_cache_free(ecryptfs_sb_info_cache, sb_info); |
125 | ecryptfs_set_superblock_private(sb, NULL); | 128 | ecryptfs_set_superblock_private(sb, NULL); |
129 | |||
130 | unlock_kernel(); | ||
126 | } | 131 | } |
127 | 132 | ||
128 | /** | 133 | /** |
diff --git a/fs/exofs/super.c b/fs/exofs/super.c index 3cdb761db8ad..cd1f8b18a218 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c | |||
@@ -258,6 +258,8 @@ static void exofs_put_super(struct super_block *sb) | |||
258 | int num_pend; | 258 | int num_pend; |
259 | struct exofs_sb_info *sbi = sb->s_fs_info; | 259 | struct exofs_sb_info *sbi = sb->s_fs_info; |
260 | 260 | ||
261 | lock_kernel(); | ||
262 | |||
261 | if (sb->s_dirt) | 263 | if (sb->s_dirt) |
262 | exofs_write_super(sb); | 264 | exofs_write_super(sb); |
263 | 265 | ||
@@ -274,6 +276,8 @@ static void exofs_put_super(struct super_block *sb) | |||
274 | osduld_put_device(sbi->s_dev); | 276 | osduld_put_device(sbi->s_dev); |
275 | kfree(sb->s_fs_info); | 277 | kfree(sb->s_fs_info); |
276 | sb->s_fs_info = NULL; | 278 | sb->s_fs_info = NULL; |
279 | |||
280 | unlock_kernel(); | ||
277 | } | 281 | } |
278 | 282 | ||
279 | /* | 283 | /* |
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 932a2bcb6908..a44963d8edbd 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -114,6 +114,8 @@ static void ext2_put_super (struct super_block * sb) | |||
114 | int i; | 114 | int i; |
115 | struct ext2_sb_info *sbi = EXT2_SB(sb); | 115 | struct ext2_sb_info *sbi = EXT2_SB(sb); |
116 | 116 | ||
117 | lock_kernel(); | ||
118 | |||
117 | if (sb->s_dirt) | 119 | if (sb->s_dirt) |
118 | ext2_write_super(sb); | 120 | ext2_write_super(sb); |
119 | 121 | ||
@@ -138,7 +140,7 @@ static void ext2_put_super (struct super_block * sb) | |||
138 | kfree(sbi->s_blockgroup_lock); | 140 | kfree(sbi->s_blockgroup_lock); |
139 | kfree(sbi); | 141 | kfree(sbi); |
140 | 142 | ||
141 | return; | 143 | unlock_kernel(); |
142 | } | 144 | } |
143 | 145 | ||
144 | static struct kmem_cache * ext2_inode_cachep; | 146 | static struct kmem_cache * ext2_inode_cachep; |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 1efd958687e9..546b8d732bf2 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -398,6 +398,8 @@ static void ext3_put_super (struct super_block * sb) | |||
398 | struct ext3_super_block *es = sbi->s_es; | 398 | struct ext3_super_block *es = sbi->s_es; |
399 | int i, err; | 399 | int i, err; |
400 | 400 | ||
401 | lock_kernel(); | ||
402 | |||
401 | ext3_xattr_put_super(sb); | 403 | ext3_xattr_put_super(sb); |
402 | err = journal_destroy(sbi->s_journal); | 404 | err = journal_destroy(sbi->s_journal); |
403 | sbi->s_journal = NULL; | 405 | sbi->s_journal = NULL; |
@@ -446,7 +448,8 @@ static void ext3_put_super (struct super_block * sb) | |||
446 | sb->s_fs_info = NULL; | 448 | sb->s_fs_info = NULL; |
447 | kfree(sbi->s_blockgroup_lock); | 449 | kfree(sbi->s_blockgroup_lock); |
448 | kfree(sbi); | 450 | kfree(sbi); |
449 | return; | 451 | |
452 | unlock_kernel(); | ||
450 | } | 453 | } |
451 | 454 | ||
452 | static struct kmem_cache *ext3_inode_cachep; | 455 | static struct kmem_cache *ext3_inode_cachep; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 0d3034c5e8a4..1d4180b86772 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -577,6 +577,7 @@ static void ext4_put_super(struct super_block *sb) | |||
577 | int i, err; | 577 | int i, err; |
578 | 578 | ||
579 | lock_super(sb); | 579 | lock_super(sb); |
580 | lock_kernel(); | ||
580 | if (sb->s_dirt) | 581 | if (sb->s_dirt) |
581 | ext4_write_super(sb); | 582 | ext4_write_super(sb); |
582 | 583 | ||
@@ -646,7 +647,6 @@ static void ext4_put_super(struct super_block *sb) | |||
646 | unlock_super(sb); | 647 | unlock_super(sb); |
647 | kobject_put(&sbi->s_kobj); | 648 | kobject_put(&sbi->s_kobj); |
648 | wait_for_completion(&sbi->s_kobj_unregister); | 649 | wait_for_completion(&sbi->s_kobj_unregister); |
649 | lock_kernel(); | ||
650 | kfree(sbi->s_blockgroup_lock); | 650 | kfree(sbi->s_blockgroup_lock); |
651 | kfree(sbi); | 651 | kfree(sbi); |
652 | } | 652 | } |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 4978621511bf..2b88c93af227 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -451,6 +451,8 @@ static void fat_put_super(struct super_block *sb) | |||
451 | { | 451 | { |
452 | struct msdos_sb_info *sbi = MSDOS_SB(sb); | 452 | struct msdos_sb_info *sbi = MSDOS_SB(sb); |
453 | 453 | ||
454 | lock_kernel(); | ||
455 | |||
454 | if (sb->s_dirt) | 456 | if (sb->s_dirt) |
455 | fat_write_super(sb); | 457 | fat_write_super(sb); |
456 | 458 | ||
@@ -470,6 +472,8 @@ static void fat_put_super(struct super_block *sb) | |||
470 | 472 | ||
471 | sb->s_fs_info = NULL; | 473 | sb->s_fs_info = NULL; |
472 | kfree(sbi); | 474 | kfree(sbi); |
475 | |||
476 | unlock_kernel(); | ||
473 | } | 477 | } |
474 | 478 | ||
475 | static struct kmem_cache *fat_inode_cachep; | 479 | static struct kmem_cache *fat_inode_cachep; |
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index 1dacda831577..cdbd1654e4cd 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c | |||
@@ -80,12 +80,16 @@ vxfs_put_super(struct super_block *sbp) | |||
80 | { | 80 | { |
81 | struct vxfs_sb_info *infp = VXFS_SBI(sbp); | 81 | struct vxfs_sb_info *infp = VXFS_SBI(sbp); |
82 | 82 | ||
83 | lock_kernel(); | ||
84 | |||
83 | vxfs_put_fake_inode(infp->vsi_fship); | 85 | vxfs_put_fake_inode(infp->vsi_fship); |
84 | vxfs_put_fake_inode(infp->vsi_ilist); | 86 | vxfs_put_fake_inode(infp->vsi_ilist); |
85 | vxfs_put_fake_inode(infp->vsi_stilist); | 87 | vxfs_put_fake_inode(infp->vsi_stilist); |
86 | 88 | ||
87 | brelse(infp->vsi_bp); | 89 | brelse(infp->vsi_bp); |
88 | kfree(infp); | 90 | kfree(infp); |
91 | |||
92 | unlock_kernel(); | ||
89 | } | 93 | } |
90 | 94 | ||
91 | /** | 95 | /** |
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 0a6801336470..c8930b31cdf0 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -719,6 +719,8 @@ static void gfs2_put_super(struct super_block *sb) | |||
719 | int error; | 719 | int error; |
720 | struct gfs2_jdesc *jd; | 720 | struct gfs2_jdesc *jd; |
721 | 721 | ||
722 | lock_kernel(); | ||
723 | |||
722 | /* Unfreeze the filesystem, if we need to */ | 724 | /* Unfreeze the filesystem, if we need to */ |
723 | 725 | ||
724 | mutex_lock(&sdp->sd_freeze_lock); | 726 | mutex_lock(&sdp->sd_freeze_lock); |
@@ -785,6 +787,8 @@ restart: | |||
785 | 787 | ||
786 | /* At this point, we're through participating in the lockspace */ | 788 | /* At this point, we're through participating in the lockspace */ |
787 | gfs2_sys_fs_del(sdp); | 789 | gfs2_sys_fs_del(sdp); |
790 | |||
791 | unlock_kernel(); | ||
788 | } | 792 | } |
789 | 793 | ||
790 | /** | 794 | /** |
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index e071e6d06463..9f5eaa01cc77 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -65,11 +65,15 @@ static void hfs_write_super(struct super_block *sb) | |||
65 | */ | 65 | */ |
66 | static void hfs_put_super(struct super_block *sb) | 66 | static void hfs_put_super(struct super_block *sb) |
67 | { | 67 | { |
68 | lock_kernel(); | ||
69 | |||
68 | if (sb->s_dirt) | 70 | if (sb->s_dirt) |
69 | hfs_write_super(sb); | 71 | hfs_write_super(sb); |
70 | hfs_mdb_close(sb); | 72 | hfs_mdb_close(sb); |
71 | /* release the MDB's resources */ | 73 | /* release the MDB's resources */ |
72 | hfs_mdb_put(sb); | 74 | hfs_mdb_put(sb); |
75 | |||
76 | unlock_kernel(); | ||
73 | } | 77 | } |
74 | 78 | ||
75 | /* | 79 | /* |
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 40bdab79dae8..9b292dcc39c8 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -199,6 +199,9 @@ static void hfsplus_put_super(struct super_block *sb) | |||
199 | dprint(DBG_SUPER, "hfsplus_put_super\n"); | 199 | dprint(DBG_SUPER, "hfsplus_put_super\n"); |
200 | if (!sb->s_fs_info) | 200 | if (!sb->s_fs_info) |
201 | return; | 201 | return; |
202 | |||
203 | lock_kernel(); | ||
204 | |||
202 | if (sb->s_dirt) | 205 | if (sb->s_dirt) |
203 | hfsplus_write_super(sb); | 206 | hfsplus_write_super(sb); |
204 | if (!(sb->s_flags & MS_RDONLY) && HFSPLUS_SB(sb).s_vhdr) { | 207 | if (!(sb->s_flags & MS_RDONLY) && HFSPLUS_SB(sb).s_vhdr) { |
@@ -220,6 +223,8 @@ static void hfsplus_put_super(struct super_block *sb) | |||
220 | unload_nls(HFSPLUS_SB(sb).nls); | 223 | unload_nls(HFSPLUS_SB(sb).nls); |
221 | kfree(sb->s_fs_info); | 224 | kfree(sb->s_fs_info); |
222 | sb->s_fs_info = NULL; | 225 | sb->s_fs_info = NULL; |
226 | |||
227 | unlock_kernel(); | ||
223 | } | 228 | } |
224 | 229 | ||
225 | static int hfsplus_statfs(struct dentry *dentry, struct kstatfs *buf) | 230 | static int hfsplus_statfs(struct dentry *dentry, struct kstatfs *buf) |
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index fc77965be841..437a32e9deac 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -99,11 +99,16 @@ int hpfs_stop_cycles(struct super_block *s, int key, int *c1, int *c2, | |||
99 | static void hpfs_put_super(struct super_block *s) | 99 | static void hpfs_put_super(struct super_block *s) |
100 | { | 100 | { |
101 | struct hpfs_sb_info *sbi = hpfs_sb(s); | 101 | struct hpfs_sb_info *sbi = hpfs_sb(s); |
102 | |||
103 | lock_kernel(); | ||
104 | |||
102 | kfree(sbi->sb_cp_table); | 105 | kfree(sbi->sb_cp_table); |
103 | kfree(sbi->sb_bmp_dir); | 106 | kfree(sbi->sb_bmp_dir); |
104 | unmark_dirty(s); | 107 | unmark_dirty(s); |
105 | s->s_fs_info = NULL; | 108 | s->s_fs_info = NULL; |
106 | kfree(sbi); | 109 | kfree(sbi); |
110 | |||
111 | unlock_kernel(); | ||
107 | } | 112 | } |
108 | 113 | ||
109 | unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno) | 114 | unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno) |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index b4cbe9603c7d..068b34b5a107 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -42,11 +42,16 @@ static int isofs_dentry_cmp_ms(struct dentry *dentry, struct qstr *a, struct qst | |||
42 | static void isofs_put_super(struct super_block *sb) | 42 | static void isofs_put_super(struct super_block *sb) |
43 | { | 43 | { |
44 | struct isofs_sb_info *sbi = ISOFS_SB(sb); | 44 | struct isofs_sb_info *sbi = ISOFS_SB(sb); |
45 | |||
45 | #ifdef CONFIG_JOLIET | 46 | #ifdef CONFIG_JOLIET |
47 | lock_kernel(); | ||
48 | |||
46 | if (sbi->s_nls_iocharset) { | 49 | if (sbi->s_nls_iocharset) { |
47 | unload_nls(sbi->s_nls_iocharset); | 50 | unload_nls(sbi->s_nls_iocharset); |
48 | sbi->s_nls_iocharset = NULL; | 51 | sbi->s_nls_iocharset = NULL; |
49 | } | 52 | } |
53 | |||
54 | unlock_kernel(); | ||
50 | #endif | 55 | #endif |
51 | 56 | ||
52 | kfree(sbi); | 57 | kfree(sbi); |
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 5059e9633edb..37b12125c127 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -174,6 +174,8 @@ static void jffs2_put_super (struct super_block *sb) | |||
174 | 174 | ||
175 | D2(printk(KERN_DEBUG "jffs2: jffs2_put_super()\n")); | 175 | D2(printk(KERN_DEBUG "jffs2: jffs2_put_super()\n")); |
176 | 176 | ||
177 | lock_kernel(); | ||
178 | |||
177 | if (sb->s_dirt) | 179 | if (sb->s_dirt) |
178 | jffs2_write_super(sb); | 180 | jffs2_write_super(sb); |
179 | 181 | ||
@@ -195,6 +197,8 @@ static void jffs2_put_super (struct super_block *sb) | |||
195 | if (c->mtd->sync) | 197 | if (c->mtd->sync) |
196 | c->mtd->sync(c->mtd); | 198 | c->mtd->sync(c->mtd); |
197 | 199 | ||
200 | unlock_kernel(); | ||
201 | |||
198 | D1(printk(KERN_DEBUG "jffs2_put_super returning\n")); | 202 | D1(printk(KERN_DEBUG "jffs2_put_super returning\n")); |
199 | } | 203 | } |
200 | 204 | ||
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index d9b0e92b3602..3eb13adf3862 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -183,6 +183,9 @@ static void jfs_put_super(struct super_block *sb) | |||
183 | int rc; | 183 | int rc; |
184 | 184 | ||
185 | jfs_info("In jfs_put_super"); | 185 | jfs_info("In jfs_put_super"); |
186 | |||
187 | lock_kernel(); | ||
188 | |||
186 | rc = jfs_umount(sb); | 189 | rc = jfs_umount(sb); |
187 | if (rc) | 190 | if (rc) |
188 | jfs_err("jfs_umount failed with return code %d", rc); | 191 | jfs_err("jfs_umount failed with return code %d", rc); |
@@ -195,6 +198,8 @@ static void jfs_put_super(struct super_block *sb) | |||
195 | sbi->direct_inode = NULL; | 198 | sbi->direct_inode = NULL; |
196 | 199 | ||
197 | kfree(sbi); | 200 | kfree(sbi); |
201 | |||
202 | unlock_kernel(); | ||
198 | } | 203 | } |
199 | 204 | ||
200 | enum { | 205 | enum { |
diff --git a/fs/minix/inode.c b/fs/minix/inode.c index daad3c2740db..7eb53970f4bc 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c | |||
@@ -35,6 +35,8 @@ static void minix_put_super(struct super_block *sb) | |||
35 | int i; | 35 | int i; |
36 | struct minix_sb_info *sbi = minix_sb(sb); | 36 | struct minix_sb_info *sbi = minix_sb(sb); |
37 | 37 | ||
38 | lock_kernel(); | ||
39 | |||
38 | if (!(sb->s_flags & MS_RDONLY)) { | 40 | if (!(sb->s_flags & MS_RDONLY)) { |
39 | if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ | 41 | if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ |
40 | sbi->s_ms->s_state = sbi->s_mount_state; | 42 | sbi->s_ms->s_state = sbi->s_mount_state; |
@@ -49,7 +51,7 @@ static void minix_put_super(struct super_block *sb) | |||
49 | sb->s_fs_info = NULL; | 51 | sb->s_fs_info = NULL; |
50 | kfree(sbi); | 52 | kfree(sbi); |
51 | 53 | ||
52 | return; | 54 | unlock_kernel(); |
53 | } | 55 | } |
54 | 56 | ||
55 | static struct kmem_cache * minix_inode_cachep; | 57 | static struct kmem_cache * minix_inode_cachep; |
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index d642f0e5b365..b99ce205b1bd 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
@@ -736,6 +736,8 @@ static void ncp_put_super(struct super_block *sb) | |||
736 | { | 736 | { |
737 | struct ncp_server *server = NCP_SBP(sb); | 737 | struct ncp_server *server = NCP_SBP(sb); |
738 | 738 | ||
739 | lock_kernel(); | ||
740 | |||
739 | ncp_lock_server(server); | 741 | ncp_lock_server(server); |
740 | ncp_disconnect(server); | 742 | ncp_disconnect(server); |
741 | ncp_unlock_server(server); | 743 | ncp_unlock_server(server); |
@@ -769,6 +771,8 @@ static void ncp_put_super(struct super_block *sb) | |||
769 | vfree(server->packet); | 771 | vfree(server->packet); |
770 | sb->s_fs_info = NULL; | 772 | sb->s_fs_info = NULL; |
771 | kfree(server); | 773 | kfree(server); |
774 | |||
775 | unlock_kernel(); | ||
772 | } | 776 | } |
773 | 777 | ||
774 | static int ncp_statfs(struct dentry *dentry, struct kstatfs *buf) | 778 | static int ncp_statfs(struct dentry *dentry, struct kstatfs *buf) |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 7901d8cbb9b1..7262e8427c20 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -316,6 +316,8 @@ static void nilfs_put_super(struct super_block *sb) | |||
316 | struct nilfs_sb_info *sbi = NILFS_SB(sb); | 316 | struct nilfs_sb_info *sbi = NILFS_SB(sb); |
317 | struct the_nilfs *nilfs = sbi->s_nilfs; | 317 | struct the_nilfs *nilfs = sbi->s_nilfs; |
318 | 318 | ||
319 | lock_kernel(); | ||
320 | |||
319 | if (sb->s_dirt) | 321 | if (sb->s_dirt) |
320 | nilfs_write_super(sb); | 322 | nilfs_write_super(sb); |
321 | 323 | ||
@@ -333,6 +335,8 @@ static void nilfs_put_super(struct super_block *sb) | |||
333 | sbi->s_super = NULL; | 335 | sbi->s_super = NULL; |
334 | sb->s_fs_info = NULL; | 336 | sb->s_fs_info = NULL; |
335 | kfree(sbi); | 337 | kfree(sbi); |
338 | |||
339 | unlock_kernel(); | ||
336 | } | 340 | } |
337 | 341 | ||
338 | /** | 342 | /** |
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 6aa7c4713536..a9ec4e1084e4 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -2246,6 +2246,9 @@ static void ntfs_put_super(struct super_block *sb) | |||
2246 | ntfs_volume *vol = NTFS_SB(sb); | 2246 | ntfs_volume *vol = NTFS_SB(sb); |
2247 | 2247 | ||
2248 | ntfs_debug("Entering."); | 2248 | ntfs_debug("Entering."); |
2249 | |||
2250 | lock_kernel(); | ||
2251 | |||
2249 | #ifdef NTFS_RW | 2252 | #ifdef NTFS_RW |
2250 | /* | 2253 | /* |
2251 | * Commit all inodes while they are still open in case some of them | 2254 | * Commit all inodes while they are still open in case some of them |
@@ -2444,7 +2447,8 @@ static void ntfs_put_super(struct super_block *sb) | |||
2444 | } | 2447 | } |
2445 | sb->s_fs_info = NULL; | 2448 | sb->s_fs_info = NULL; |
2446 | kfree(vol); | 2449 | kfree(vol); |
2447 | return; | 2450 | |
2451 | unlock_kernel(); | ||
2448 | } | 2452 | } |
2449 | 2453 | ||
2450 | /** | 2454 | /** |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 3eb076ce4c07..02737596b597 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -1536,9 +1536,13 @@ static void ocfs2_put_super(struct super_block *sb) | |||
1536 | { | 1536 | { |
1537 | mlog_entry("(0x%p)\n", sb); | 1537 | mlog_entry("(0x%p)\n", sb); |
1538 | 1538 | ||
1539 | lock_kernel(); | ||
1540 | |||
1539 | ocfs2_sync_blockdev(sb); | 1541 | ocfs2_sync_blockdev(sb); |
1540 | ocfs2_dismount_volume(sb, 0); | 1542 | ocfs2_dismount_volume(sb, 0); |
1541 | 1543 | ||
1544 | unlock_kernel(); | ||
1545 | |||
1542 | mlog_exit_void(); | 1546 | mlog_exit_void(); |
1543 | } | 1547 | } |
1544 | 1548 | ||
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 3da0401c0a96..90dcb7b033ea 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -465,6 +465,8 @@ static void reiserfs_put_super(struct super_block *s) | |||
465 | struct reiserfs_transaction_handle th; | 465 | struct reiserfs_transaction_handle th; |
466 | th.t_trans_id = 0; | 466 | th.t_trans_id = 0; |
467 | 467 | ||
468 | lock_kernel(); | ||
469 | |||
468 | if (s->s_dirt) | 470 | if (s->s_dirt) |
469 | reiserfs_write_super(s); | 471 | reiserfs_write_super(s); |
470 | 472 | ||
@@ -500,7 +502,7 @@ static void reiserfs_put_super(struct super_block *s) | |||
500 | kfree(s->s_fs_info); | 502 | kfree(s->s_fs_info); |
501 | s->s_fs_info = NULL; | 503 | s->s_fs_info = NULL; |
502 | 504 | ||
503 | return; | 505 | unlock_kernel(); |
504 | } | 506 | } |
505 | 507 | ||
506 | static struct kmem_cache *reiserfs_inode_cachep; | 508 | static struct kmem_cache *reiserfs_inode_cachep; |
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index fc27fbfc5397..1402d2d54f52 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c | |||
@@ -474,6 +474,8 @@ smb_put_super(struct super_block *sb) | |||
474 | { | 474 | { |
475 | struct smb_sb_info *server = SMB_SB(sb); | 475 | struct smb_sb_info *server = SMB_SB(sb); |
476 | 476 | ||
477 | lock_kernel(); | ||
478 | |||
477 | smb_lock_server(server); | 479 | smb_lock_server(server); |
478 | server->state = CONN_INVALID; | 480 | server->state = CONN_INVALID; |
479 | smbiod_unregister_server(server); | 481 | smbiod_unregister_server(server); |
@@ -489,6 +491,8 @@ smb_put_super(struct super_block *sb) | |||
489 | smb_unlock_server(server); | 491 | smb_unlock_server(server); |
490 | put_pid(server->conn_pid); | 492 | put_pid(server->conn_pid); |
491 | kfree(server); | 493 | kfree(server); |
494 | |||
495 | unlock_kernel(); | ||
492 | } | 496 | } |
493 | 497 | ||
494 | static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) | 498 | static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) |
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c index 0adc624c956f..3b52770f46ff 100644 --- a/fs/squashfs/super.c +++ b/fs/squashfs/super.c | |||
@@ -338,6 +338,8 @@ static int squashfs_remount(struct super_block *sb, int *flags, char *data) | |||
338 | 338 | ||
339 | static void squashfs_put_super(struct super_block *sb) | 339 | static void squashfs_put_super(struct super_block *sb) |
340 | { | 340 | { |
341 | lock_kernel(); | ||
342 | |||
341 | if (sb->s_fs_info) { | 343 | if (sb->s_fs_info) { |
342 | struct squashfs_sb_info *sbi = sb->s_fs_info; | 344 | struct squashfs_sb_info *sbi = sb->s_fs_info; |
343 | squashfs_cache_delete(sbi->block_cache); | 345 | squashfs_cache_delete(sbi->block_cache); |
@@ -350,6 +352,8 @@ static void squashfs_put_super(struct super_block *sb) | |||
350 | kfree(sb->s_fs_info); | 352 | kfree(sb->s_fs_info); |
351 | sb->s_fs_info = NULL; | 353 | sb->s_fs_info = NULL; |
352 | } | 354 | } |
355 | |||
356 | unlock_kernel(); | ||
353 | } | 357 | } |
354 | 358 | ||
355 | 359 | ||
diff --git a/fs/super.c b/fs/super.c index 54fd331f0cab..bdd7158b785e 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -309,7 +309,6 @@ void generic_shutdown_super(struct super_block *sb) | |||
309 | 309 | ||
310 | /* bad name - it should be evict_inodes() */ | 310 | /* bad name - it should be evict_inodes() */ |
311 | invalidate_inodes(sb); | 311 | invalidate_inodes(sb); |
312 | lock_kernel(); | ||
313 | 312 | ||
314 | if (sop->put_super) | 313 | if (sop->put_super) |
315 | sop->put_super(sb); | 314 | sop->put_super(sb); |
@@ -320,8 +319,6 @@ void generic_shutdown_super(struct super_block *sb) | |||
320 | "Self-destruct in 5 seconds. Have a nice day...\n", | 319 | "Self-destruct in 5 seconds. Have a nice day...\n", |
321 | sb->s_id); | 320 | sb->s_id); |
322 | } | 321 | } |
323 | |||
324 | unlock_kernel(); | ||
325 | put_fs_excl(); | 322 | put_fs_excl(); |
326 | } | 323 | } |
327 | spin_lock(&sb_lock); | 324 | spin_lock(&sb_lock); |
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c index cd80316302cc..a8189864c241 100644 --- a/fs/sysv/inode.c +++ b/fs/sysv/inode.c | |||
@@ -72,6 +72,8 @@ static void sysv_put_super(struct super_block *sb) | |||
72 | { | 72 | { |
73 | struct sysv_sb_info *sbi = SYSV_SB(sb); | 73 | struct sysv_sb_info *sbi = SYSV_SB(sb); |
74 | 74 | ||
75 | lock_kernel(); | ||
76 | |||
75 | if (sb->s_dirt) | 77 | if (sb->s_dirt) |
76 | sysv_write_super(sb); | 78 | sysv_write_super(sb); |
77 | 79 | ||
@@ -87,6 +89,8 @@ static void sysv_put_super(struct super_block *sb) | |||
87 | brelse(sbi->s_bh2); | 89 | brelse(sbi->s_bh2); |
88 | 90 | ||
89 | kfree(sbi); | 91 | kfree(sbi); |
92 | |||
93 | unlock_kernel(); | ||
90 | } | 94 | } |
91 | 95 | ||
92 | static int sysv_statfs(struct dentry *dentry, struct kstatfs *buf) | 96 | static int sysv_statfs(struct dentry *dentry, struct kstatfs *buf) |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 84f3c7fd1552..522c3fd7eb3c 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -1684,6 +1684,9 @@ static void ubifs_put_super(struct super_block *sb) | |||
1684 | 1684 | ||
1685 | ubifs_msg("un-mount UBI device %d, volume %d", c->vi.ubi_num, | 1685 | ubifs_msg("un-mount UBI device %d, volume %d", c->vi.ubi_num, |
1686 | c->vi.vol_id); | 1686 | c->vi.vol_id); |
1687 | |||
1688 | lock_kernel(); | ||
1689 | |||
1687 | /* | 1690 | /* |
1688 | * The following asserts are only valid if there has not been a failure | 1691 | * The following asserts are only valid if there has not been a failure |
1689 | * of the media. For example, there will be dirty inodes if we failed | 1692 | * of the media. For example, there will be dirty inodes if we failed |
@@ -1750,6 +1753,8 @@ static void ubifs_put_super(struct super_block *sb) | |||
1750 | ubi_close_volume(c->ubi); | 1753 | ubi_close_volume(c->ubi); |
1751 | mutex_unlock(&c->umount_mutex); | 1754 | mutex_unlock(&c->umount_mutex); |
1752 | kfree(c); | 1755 | kfree(c); |
1756 | |||
1757 | unlock_kernel(); | ||
1753 | } | 1758 | } |
1754 | 1759 | ||
1755 | static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) | 1760 | static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 0ba44107d8f1..04802cc39b18 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -2062,6 +2062,9 @@ static void udf_put_super(struct super_block *sb) | |||
2062 | struct udf_sb_info *sbi; | 2062 | struct udf_sb_info *sbi; |
2063 | 2063 | ||
2064 | sbi = UDF_SB(sb); | 2064 | sbi = UDF_SB(sb); |
2065 | |||
2066 | lock_kernel(); | ||
2067 | |||
2065 | if (sbi->s_vat_inode) | 2068 | if (sbi->s_vat_inode) |
2066 | iput(sbi->s_vat_inode); | 2069 | iput(sbi->s_vat_inode); |
2067 | if (sbi->s_partitions) | 2070 | if (sbi->s_partitions) |
@@ -2077,6 +2080,8 @@ static void udf_put_super(struct super_block *sb) | |||
2077 | kfree(sbi->s_partmaps); | 2080 | kfree(sbi->s_partmaps); |
2078 | kfree(sb->s_fs_info); | 2081 | kfree(sb->s_fs_info); |
2079 | sb->s_fs_info = NULL; | 2082 | sb->s_fs_info = NULL; |
2083 | |||
2084 | unlock_kernel(); | ||
2080 | } | 2085 | } |
2081 | 2086 | ||
2082 | static int udf_sync_fs(struct super_block *sb, int wait) | 2087 | static int udf_sync_fs(struct super_block *sb, int wait) |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 74afb9fbf58e..2b4d2b6234df 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -594,6 +594,9 @@ static void ufs_put_super_internal(struct super_block *sb) | |||
594 | 594 | ||
595 | 595 | ||
596 | UFSD("ENTER\n"); | 596 | UFSD("ENTER\n"); |
597 | |||
598 | lock_kernel(); | ||
599 | |||
597 | ufs_put_cstotal(sb); | 600 | ufs_put_cstotal(sb); |
598 | size = uspi->s_cssize; | 601 | size = uspi->s_cssize; |
599 | blks = (size + uspi->s_fsize - 1) >> uspi->s_fshift; | 602 | blks = (size + uspi->s_fsize - 1) >> uspi->s_fshift; |
@@ -621,6 +624,9 @@ static void ufs_put_super_internal(struct super_block *sb) | |||
621 | brelse (sbi->s_ucg[i]); | 624 | brelse (sbi->s_ucg[i]); |
622 | kfree (sbi->s_ucg); | 625 | kfree (sbi->s_ucg); |
623 | kfree (base); | 626 | kfree (base); |
627 | |||
628 | unlock_kernel(); | ||
629 | |||
624 | UFSD("EXIT\n"); | 630 | UFSD("EXIT\n"); |
625 | } | 631 | } |
626 | 632 | ||