diff options
author | Jan Blunck <jblunck@infradead.org> | 2010-08-15 16:51:10 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2010-10-04 15:10:10 -0400 |
commit | db71922217a214e5c9268448e537b54fc1f301ea (patch) | |
tree | 9c9afbf29411547891f6968e5ade29ce59d66c07 | |
parent | 899611ee7d373e5eeda08e9a8632684e1ebbbf00 (diff) |
BKL: Explicitly add BKL around get_sb/fill_super
This patch is a preparation necessary to remove the BKL from do_new_mount().
It explicitly adds calls to lock_kernel()/unlock_kernel() around
get_sb/fill_super operations for filesystems that still uses the BKL.
I've read through all the code formerly covered by the BKL inside
do_kern_mount() and have satisfied myself that it doesn't need the BKL
any more.
do_kern_mount() is already called without the BKL when mounting the rootfs
and in nfsctl. do_kern_mount() calls vfs_kern_mount(), which is called
from various places without BKL: simple_pin_fs(), nfs_do_clone_mount()
through nfs_follow_mountpoint(), afs_mntpt_do_automount() through
afs_mntpt_follow_link(). Both later functions are actually the filesystems
follow_link inode operation. vfs_kern_mount() is calling the specified
get_sb function and lets the filesystem do its job by calling the given
fill_super function.
Therefore I think it is safe to push down the BKL from the VFS to the
low-level filesystems get_sb/fill_super operation.
[arnd: do not add the BKL to those file systems that already
don't use it elsewhere]
Signed-off-by: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Christoph Hellwig <hch@infradead.org>
-rw-r--r-- | fs/adfs/super.c | 8 | ||||
-rw-r--r-- | fs/affs/super.c | 9 | ||||
-rw-r--r-- | fs/afs/super.c | 5 | ||||
-rw-r--r-- | fs/bfs/inode.c | 8 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 12 | ||||
-rw-r--r-- | fs/coda/inode.c | 8 | ||||
-rw-r--r-- | fs/ecryptfs/main.c | 4 | ||||
-rw-r--r-- | fs/ext2/super.c | 10 | ||||
-rw-r--r-- | fs/ext3/super.c | 9 | ||||
-rw-r--r-- | fs/ext4/super.c | 8 | ||||
-rw-r--r-- | fs/fat/namei_msdos.c | 7 | ||||
-rw-r--r-- | fs/fat/namei_vfat.c | 7 | ||||
-rw-r--r-- | fs/freevxfs/vxfs_super.c | 7 | ||||
-rw-r--r-- | fs/hfs/super.c | 8 | ||||
-rw-r--r-- | fs/hpfs/super.c | 8 | ||||
-rw-r--r-- | fs/isofs/inode.c | 8 | ||||
-rw-r--r-- | fs/jffs2/super.c | 11 | ||||
-rw-r--r-- | fs/jfs/super.c | 12 | ||||
-rw-r--r-- | fs/nilfs2/super.c | 8 | ||||
-rw-r--r-- | fs/ntfs/super.c | 5 | ||||
-rw-r--r-- | fs/ocfs2/dlmfs/dlmfs.c | 9 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 5 | ||||
-rw-r--r-- | fs/qnx4/inode.c | 8 | ||||
-rw-r--r-- | fs/smbfs/inode.c | 5 | ||||
-rw-r--r-- | fs/squashfs/super.c | 6 | ||||
-rw-r--r-- | fs/udf/super.c | 8 | ||||
-rw-r--r-- | fs/ufs/super.c | 5 | ||||
-rw-r--r-- | kernel/cgroup.c | 4 |
28 files changed, 187 insertions, 25 deletions
diff --git a/fs/adfs/super.c b/fs/adfs/super.c index 4a3af7075c1d..d9803f73236f 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c | |||
@@ -352,11 +352,15 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) | |||
352 | struct adfs_sb_info *asb; | 352 | struct adfs_sb_info *asb; |
353 | struct inode *root; | 353 | struct inode *root; |
354 | 354 | ||
355 | lock_kernel(); | ||
356 | |||
355 | sb->s_flags |= MS_NODIRATIME; | 357 | sb->s_flags |= MS_NODIRATIME; |
356 | 358 | ||
357 | asb = kzalloc(sizeof(*asb), GFP_KERNEL); | 359 | asb = kzalloc(sizeof(*asb), GFP_KERNEL); |
358 | if (!asb) | 360 | if (!asb) { |
361 | unlock_kernel(); | ||
359 | return -ENOMEM; | 362 | return -ENOMEM; |
363 | } | ||
360 | sb->s_fs_info = asb; | 364 | sb->s_fs_info = asb; |
361 | 365 | ||
362 | /* set default options */ | 366 | /* set default options */ |
@@ -474,6 +478,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) | |||
474 | goto error; | 478 | goto error; |
475 | } else | 479 | } else |
476 | sb->s_root->d_op = &adfs_dentry_operations; | 480 | sb->s_root->d_op = &adfs_dentry_operations; |
481 | unlock_kernel(); | ||
477 | return 0; | 482 | return 0; |
478 | 483 | ||
479 | error_free_bh: | 484 | error_free_bh: |
@@ -481,6 +486,7 @@ error_free_bh: | |||
481 | error: | 486 | error: |
482 | sb->s_fs_info = NULL; | 487 | sb->s_fs_info = NULL; |
483 | kfree(asb); | 488 | kfree(asb); |
489 | unlock_kernel(); | ||
484 | return -EINVAL; | 490 | return -EINVAL; |
485 | } | 491 | } |
486 | 492 | ||
diff --git a/fs/affs/super.c b/fs/affs/super.c index 33c4e7eef470..3a6d1dee4a51 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
@@ -291,6 +291,8 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) | |||
291 | u8 sig[4]; | 291 | u8 sig[4]; |
292 | int ret = -EINVAL; | 292 | int ret = -EINVAL; |
293 | 293 | ||
294 | lock_kernel(); | ||
295 | |||
294 | save_mount_options(sb, data); | 296 | save_mount_options(sb, data); |
295 | 297 | ||
296 | pr_debug("AFFS: read_super(%s)\n",data ? (const char *)data : "no options"); | 298 | pr_debug("AFFS: read_super(%s)\n",data ? (const char *)data : "no options"); |
@@ -300,8 +302,10 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) | |||
300 | sb->s_flags |= MS_NODIRATIME; | 302 | sb->s_flags |= MS_NODIRATIME; |
301 | 303 | ||
302 | sbi = kzalloc(sizeof(struct affs_sb_info), GFP_KERNEL); | 304 | sbi = kzalloc(sizeof(struct affs_sb_info), GFP_KERNEL); |
303 | if (!sbi) | 305 | if (!sbi) { |
306 | unlock_kernel(); | ||
304 | return -ENOMEM; | 307 | return -ENOMEM; |
308 | } | ||
305 | sb->s_fs_info = sbi; | 309 | sb->s_fs_info = sbi; |
306 | mutex_init(&sbi->s_bmlock); | 310 | mutex_init(&sbi->s_bmlock); |
307 | spin_lock_init(&sbi->symlink_lock); | 311 | spin_lock_init(&sbi->symlink_lock); |
@@ -312,6 +316,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) | |||
312 | printk(KERN_ERR "AFFS: Error parsing options\n"); | 316 | printk(KERN_ERR "AFFS: Error parsing options\n"); |
313 | kfree(sbi->s_prefix); | 317 | kfree(sbi->s_prefix); |
314 | kfree(sbi); | 318 | kfree(sbi); |
319 | unlock_kernel(); | ||
315 | return -EINVAL; | 320 | return -EINVAL; |
316 | } | 321 | } |
317 | /* N.B. after this point s_prefix must be released */ | 322 | /* N.B. after this point s_prefix must be released */ |
@@ -482,6 +487,7 @@ got_root: | |||
482 | sb->s_root->d_op = &affs_dentry_operations; | 487 | sb->s_root->d_op = &affs_dentry_operations; |
483 | 488 | ||
484 | pr_debug("AFFS: s_flags=%lX\n",sb->s_flags); | 489 | pr_debug("AFFS: s_flags=%lX\n",sb->s_flags); |
490 | unlock_kernel(); | ||
485 | return 0; | 491 | return 0; |
486 | 492 | ||
487 | /* | 493 | /* |
@@ -496,6 +502,7 @@ out_error_noinode: | |||
496 | kfree(sbi->s_prefix); | 502 | kfree(sbi->s_prefix); |
497 | kfree(sbi); | 503 | kfree(sbi); |
498 | sb->s_fs_info = NULL; | 504 | sb->s_fs_info = NULL; |
505 | unlock_kernel(); | ||
499 | return ret; | 506 | return ret; |
500 | } | 507 | } |
501 | 508 | ||
diff --git a/fs/afs/super.c b/fs/afs/super.c index 77e1e5a61154..6c2fef44d385 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c | |||
@@ -302,12 +302,15 @@ static int afs_fill_super(struct super_block *sb, void *data) | |||
302 | struct inode *inode = NULL; | 302 | struct inode *inode = NULL; |
303 | int ret; | 303 | int ret; |
304 | 304 | ||
305 | lock_kernel(); | ||
306 | |||
305 | _enter(""); | 307 | _enter(""); |
306 | 308 | ||
307 | /* allocate a superblock info record */ | 309 | /* allocate a superblock info record */ |
308 | as = kzalloc(sizeof(struct afs_super_info), GFP_KERNEL); | 310 | as = kzalloc(sizeof(struct afs_super_info), GFP_KERNEL); |
309 | if (!as) { | 311 | if (!as) { |
310 | _leave(" = -ENOMEM"); | 312 | _leave(" = -ENOMEM"); |
313 | unlock_kernel(); | ||
311 | return -ENOMEM; | 314 | return -ENOMEM; |
312 | } | 315 | } |
313 | 316 | ||
@@ -341,6 +344,7 @@ static int afs_fill_super(struct super_block *sb, void *data) | |||
341 | sb->s_root = root; | 344 | sb->s_root = root; |
342 | 345 | ||
343 | _leave(" = 0"); | 346 | _leave(" = 0"); |
347 | unlock_kernel(); | ||
344 | return 0; | 348 | return 0; |
345 | 349 | ||
346 | error_inode: | 350 | error_inode: |
@@ -354,6 +358,7 @@ error: | |||
354 | sb->s_fs_info = NULL; | 358 | sb->s_fs_info = NULL; |
355 | 359 | ||
356 | _leave(" = %d", ret); | 360 | _leave(" = %d", ret); |
361 | unlock_kernel(); | ||
357 | return ret; | 362 | return ret; |
358 | } | 363 | } |
359 | 364 | ||
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index c4daf0f5fc02..d2e09363dd93 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c | |||
@@ -322,9 +322,13 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
322 | int ret = -EINVAL; | 322 | int ret = -EINVAL; |
323 | unsigned long i_sblock, i_eblock, i_eoff, s_size; | 323 | unsigned long i_sblock, i_eblock, i_eoff, s_size; |
324 | 324 | ||
325 | lock_kernel(); | ||
326 | |||
325 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 327 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
326 | if (!info) | 328 | if (!info) { |
329 | unlock_kernel(); | ||
327 | return -ENOMEM; | 330 | return -ENOMEM; |
331 | } | ||
328 | mutex_init(&info->bfs_lock); | 332 | mutex_init(&info->bfs_lock); |
329 | s->s_fs_info = info; | 333 | s->s_fs_info = info; |
330 | 334 | ||
@@ -439,6 +443,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
439 | brelse(bh); | 443 | brelse(bh); |
440 | brelse(sbh); | 444 | brelse(sbh); |
441 | dump_imap("read_super", s); | 445 | dump_imap("read_super", s); |
446 | unlock_kernel(); | ||
442 | return 0; | 447 | return 0; |
443 | 448 | ||
444 | out3: | 449 | out3: |
@@ -452,6 +457,7 @@ out: | |||
452 | mutex_destroy(&info->bfs_lock); | 457 | mutex_destroy(&info->bfs_lock); |
453 | kfree(info); | 458 | kfree(info); |
454 | s->s_fs_info = NULL; | 459 | s->s_fs_info = NULL; |
460 | unlock_kernel(); | ||
455 | return ret; | 461 | return ret; |
456 | } | 462 | } |
457 | 463 | ||
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index b7431afdd76d..070bf1aecd2d 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -514,22 +514,30 @@ cifs_get_sb(struct file_system_type *fs_type, | |||
514 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) | 514 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
515 | { | 515 | { |
516 | int rc; | 516 | int rc; |
517 | struct super_block *sb = sget(fs_type, NULL, set_anon_super, NULL); | 517 | struct super_block *sb; |
518 | |||
519 | lock_kernel(); | ||
520 | |||
521 | sb = sget(fs_type, NULL, set_anon_super, NULL); | ||
518 | 522 | ||
519 | cFYI(1, "Devname: %s flags: %d ", dev_name, flags); | 523 | cFYI(1, "Devname: %s flags: %d ", dev_name, flags); |
520 | 524 | ||
521 | if (IS_ERR(sb)) | 525 | if (IS_ERR(sb)) { |
526 | unlock_kernel(); | ||
522 | return PTR_ERR(sb); | 527 | return PTR_ERR(sb); |
528 | } | ||
523 | 529 | ||
524 | sb->s_flags = flags; | 530 | sb->s_flags = flags; |
525 | 531 | ||
526 | rc = cifs_read_super(sb, data, dev_name, flags & MS_SILENT ? 1 : 0); | 532 | rc = cifs_read_super(sb, data, dev_name, flags & MS_SILENT ? 1 : 0); |
527 | if (rc) { | 533 | if (rc) { |
528 | deactivate_locked_super(sb); | 534 | deactivate_locked_super(sb); |
535 | unlock_kernel(); | ||
529 | return rc; | 536 | return rc; |
530 | } | 537 | } |
531 | sb->s_flags |= MS_ACTIVE; | 538 | sb->s_flags |= MS_ACTIVE; |
532 | simple_set_mnt(mnt, sb); | 539 | simple_set_mnt(mnt, sb); |
540 | unlock_kernel(); | ||
533 | return 0; | 541 | return 0; |
534 | } | 542 | } |
535 | 543 | ||
diff --git a/fs/coda/inode.c b/fs/coda/inode.c index 6526e6f21ecf..bfe8179b1295 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c | |||
@@ -148,6 +148,8 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) | |||
148 | int error; | 148 | int error; |
149 | int idx; | 149 | int idx; |
150 | 150 | ||
151 | lock_kernel(); | ||
152 | |||
151 | idx = get_device_index((struct coda_mount_data *) data); | 153 | idx = get_device_index((struct coda_mount_data *) data); |
152 | 154 | ||
153 | /* Ignore errors in data, for backward compatibility */ | 155 | /* Ignore errors in data, for backward compatibility */ |
@@ -159,11 +161,13 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) | |||
159 | vc = &coda_comms[idx]; | 161 | vc = &coda_comms[idx]; |
160 | if (!vc->vc_inuse) { | 162 | if (!vc->vc_inuse) { |
161 | printk("coda_read_super: No pseudo device\n"); | 163 | printk("coda_read_super: No pseudo device\n"); |
164 | unlock_kernel(); | ||
162 | return -EINVAL; | 165 | return -EINVAL; |
163 | } | 166 | } |
164 | 167 | ||
165 | if ( vc->vc_sb ) { | 168 | if ( vc->vc_sb ) { |
166 | printk("coda_read_super: Device already mounted\n"); | 169 | printk("coda_read_super: Device already mounted\n"); |
170 | unlock_kernel(); | ||
167 | return -EBUSY; | 171 | return -EBUSY; |
168 | } | 172 | } |
169 | 173 | ||
@@ -202,7 +206,8 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) | |||
202 | sb->s_root = d_alloc_root(root); | 206 | sb->s_root = d_alloc_root(root); |
203 | if (!sb->s_root) | 207 | if (!sb->s_root) |
204 | goto error; | 208 | goto error; |
205 | return 0; | 209 | unlock_kernel(); |
210 | return 0; | ||
206 | 211 | ||
207 | error: | 212 | error: |
208 | bdi_destroy(&vc->bdi); | 213 | bdi_destroy(&vc->bdi); |
@@ -212,6 +217,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) | |||
212 | if (vc) | 217 | if (vc) |
213 | vc->vc_sb = NULL; | 218 | vc->vc_sb = NULL; |
214 | 219 | ||
220 | unlock_kernel(); | ||
215 | return -EINVAL; | 221 | return -EINVAL; |
216 | } | 222 | } |
217 | 223 | ||
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index cbd4e18adb20..c4af92fa12c3 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/parser.h> | 36 | #include <linux/parser.h> |
37 | #include <linux/fs_stack.h> | 37 | #include <linux/fs_stack.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/smp_lock.h> /* For lock_kernel() */ | ||
39 | #include "ecryptfs_kernel.h" | 40 | #include "ecryptfs_kernel.h" |
40 | 41 | ||
41 | /** | 42 | /** |
@@ -550,6 +551,7 @@ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, | |||
550 | const char *err = "Getting sb failed"; | 551 | const char *err = "Getting sb failed"; |
551 | int rc; | 552 | int rc; |
552 | 553 | ||
554 | lock_kernel(); | ||
553 | sbi = kmem_cache_zalloc(ecryptfs_sb_info_cache, GFP_KERNEL); | 555 | sbi = kmem_cache_zalloc(ecryptfs_sb_info_cache, GFP_KERNEL); |
554 | if (!sbi) { | 556 | if (!sbi) { |
555 | rc = -ENOMEM; | 557 | rc = -ENOMEM; |
@@ -608,6 +610,7 @@ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, | |||
608 | goto out; | 610 | goto out; |
609 | } | 611 | } |
610 | simple_set_mnt(mnt, s); | 612 | simple_set_mnt(mnt, s); |
613 | unlock_kernel(); | ||
611 | return 0; | 614 | return 0; |
612 | 615 | ||
613 | out: | 616 | out: |
@@ -616,6 +619,7 @@ out: | |||
616 | kmem_cache_free(ecryptfs_sb_info_cache, sbi); | 619 | kmem_cache_free(ecryptfs_sb_info_cache, sbi); |
617 | } | 620 | } |
618 | printk(KERN_ERR "%s; rc = [%d]\n", err, rc); | 621 | printk(KERN_ERR "%s; rc = [%d]\n", err, rc); |
622 | unlock_kernel(); | ||
619 | return rc; | 623 | return rc; |
620 | } | 624 | } |
621 | 625 | ||
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 1ec602673ea8..f98c390caf1d 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -747,15 +747,18 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
747 | __le32 features; | 747 | __le32 features; |
748 | int err; | 748 | int err; |
749 | 749 | ||
750 | lock_kernel(); | ||
751 | |||
752 | err = -ENOMEM; | ||
750 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | 753 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); |
751 | if (!sbi) | 754 | if (!sbi) |
752 | return -ENOMEM; | 755 | goto failed_unlock; |
753 | 756 | ||
754 | sbi->s_blockgroup_lock = | 757 | sbi->s_blockgroup_lock = |
755 | kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL); | 758 | kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL); |
756 | if (!sbi->s_blockgroup_lock) { | 759 | if (!sbi->s_blockgroup_lock) { |
757 | kfree(sbi); | 760 | kfree(sbi); |
758 | return -ENOMEM; | 761 | goto failed_unlock; |
759 | } | 762 | } |
760 | sb->s_fs_info = sbi; | 763 | sb->s_fs_info = sbi; |
761 | sbi->s_sb_block = sb_block; | 764 | sbi->s_sb_block = sb_block; |
@@ -1083,6 +1086,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
1083 | if (ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY)) | 1086 | if (ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY)) |
1084 | sb->s_flags |= MS_RDONLY; | 1087 | sb->s_flags |= MS_RDONLY; |
1085 | ext2_write_super(sb); | 1088 | ext2_write_super(sb); |
1089 | unlock_kernel(); | ||
1086 | return 0; | 1090 | return 0; |
1087 | 1091 | ||
1088 | cantfind_ext2: | 1092 | cantfind_ext2: |
@@ -1107,6 +1111,8 @@ failed_sbi: | |||
1107 | sb->s_fs_info = NULL; | 1111 | sb->s_fs_info = NULL; |
1108 | kfree(sbi->s_blockgroup_lock); | 1112 | kfree(sbi->s_blockgroup_lock); |
1109 | kfree(sbi); | 1113 | kfree(sbi); |
1114 | failed_unlock: | ||
1115 | unlock_kernel(); | ||
1110 | return ret; | 1116 | return ret; |
1111 | } | 1117 | } |
1112 | 1118 | ||
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 5dbf4dba03c4..41f9dcd73e97 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -1611,14 +1611,19 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1611 | __le32 features; | 1611 | __le32 features; |
1612 | int err; | 1612 | int err; |
1613 | 1613 | ||
1614 | lock_kernel(); | ||
1615 | |||
1614 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | 1616 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); |
1615 | if (!sbi) | 1617 | if (!sbi) { |
1618 | unlock_kernel(); | ||
1616 | return -ENOMEM; | 1619 | return -ENOMEM; |
1620 | } | ||
1617 | 1621 | ||
1618 | sbi->s_blockgroup_lock = | 1622 | sbi->s_blockgroup_lock = |
1619 | kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL); | 1623 | kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL); |
1620 | if (!sbi->s_blockgroup_lock) { | 1624 | if (!sbi->s_blockgroup_lock) { |
1621 | kfree(sbi); | 1625 | kfree(sbi); |
1626 | unlock_kernel(); | ||
1622 | return -ENOMEM; | 1627 | return -ENOMEM; |
1623 | } | 1628 | } |
1624 | sb->s_fs_info = sbi; | 1629 | sb->s_fs_info = sbi; |
@@ -2026,6 +2031,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
2026 | "writeback"); | 2031 | "writeback"); |
2027 | 2032 | ||
2028 | lock_kernel(); | 2033 | lock_kernel(); |
2034 | unlock_kernel(); | ||
2029 | return 0; | 2035 | return 0; |
2030 | 2036 | ||
2031 | cantfind_ext3: | 2037 | cantfind_ext3: |
@@ -2056,6 +2062,7 @@ out_fail: | |||
2056 | kfree(sbi->s_blockgroup_lock); | 2062 | kfree(sbi->s_blockgroup_lock); |
2057 | kfree(sbi); | 2063 | kfree(sbi); |
2058 | lock_kernel(); | 2064 | lock_kernel(); |
2065 | unlock_kernel(); | ||
2059 | return ret; | 2066 | return ret; |
2060 | } | 2067 | } |
2061 | 2068 | ||
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 26147746c272..0f0021f4990c 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -2568,6 +2568,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
2568 | int err; | 2568 | int err; |
2569 | unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO; | 2569 | unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO; |
2570 | 2570 | ||
2571 | lock_kernel(); | ||
2572 | |||
2571 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | 2573 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); |
2572 | if (!sbi) | 2574 | if (!sbi) |
2573 | goto out_free_orig; | 2575 | goto out_free_orig; |
@@ -3166,7 +3168,6 @@ no_journal: | |||
3166 | if (es->s_error_count) | 3168 | if (es->s_error_count) |
3167 | mod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */ | 3169 | mod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */ |
3168 | 3170 | ||
3169 | lock_kernel(); | ||
3170 | kfree(orig_data); | 3171 | kfree(orig_data); |
3171 | return 0; | 3172 | return 0; |
3172 | 3173 | ||
@@ -3213,8 +3214,11 @@ out_fail: | |||
3213 | sb->s_fs_info = NULL; | 3214 | sb->s_fs_info = NULL; |
3214 | kfree(sbi->s_blockgroup_lock); | 3215 | kfree(sbi->s_blockgroup_lock); |
3215 | kfree(sbi); | 3216 | kfree(sbi); |
3216 | lock_kernel(); | 3217 | kfree(orig_data); |
3218 | return ret; | ||
3219 | |||
3217 | out_free_orig: | 3220 | out_free_orig: |
3221 | unlock_kernel(); | ||
3218 | kfree(orig_data); | 3222 | kfree(orig_data); |
3219 | return ret; | 3223 | return ret; |
3220 | } | 3224 | } |
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c index bbc94ae4fd77..e2b0b978340d 100644 --- a/fs/fat/namei_msdos.c +++ b/fs/fat/namei_msdos.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/time.h> | 10 | #include <linux/time.h> |
11 | #include <linux/buffer_head.h> | 11 | #include <linux/buffer_head.h> |
12 | #include <linux/smp_lock.h> /* For lock_kernel() */ | ||
12 | #include "fat.h" | 13 | #include "fat.h" |
13 | 14 | ||
14 | /* Characters that are undesirable in an MS-DOS file name */ | 15 | /* Characters that are undesirable in an MS-DOS file name */ |
@@ -662,12 +663,16 @@ static int msdos_fill_super(struct super_block *sb, void *data, int silent) | |||
662 | { | 663 | { |
663 | int res; | 664 | int res; |
664 | 665 | ||
666 | lock_kernel(); | ||
665 | res = fat_fill_super(sb, data, silent, &msdos_dir_inode_operations, 0); | 667 | res = fat_fill_super(sb, data, silent, &msdos_dir_inode_operations, 0); |
666 | if (res) | 668 | if (res) { |
669 | unlock_kernel(); | ||
667 | return res; | 670 | return res; |
671 | } | ||
668 | 672 | ||
669 | sb->s_flags |= MS_NOATIME; | 673 | sb->s_flags |= MS_NOATIME; |
670 | sb->s_root->d_op = &msdos_dentry_operations; | 674 | sb->s_root->d_op = &msdos_dentry_operations; |
675 | unlock_kernel(); | ||
671 | return 0; | 676 | return 0; |
672 | } | 677 | } |
673 | 678 | ||
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index 6fcc7e71fbaa..9006ad9c7b11 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <linux/buffer_head.h> | 22 | #include <linux/buffer_head.h> |
23 | #include <linux/namei.h> | 23 | #include <linux/namei.h> |
24 | #include <linux/smp_lock.h> /* For lock_kernel() */ | ||
24 | #include "fat.h" | 25 | #include "fat.h" |
25 | 26 | ||
26 | /* | 27 | /* |
@@ -1055,15 +1056,19 @@ static int vfat_fill_super(struct super_block *sb, void *data, int silent) | |||
1055 | { | 1056 | { |
1056 | int res; | 1057 | int res; |
1057 | 1058 | ||
1059 | lock_kernel(); | ||
1058 | res = fat_fill_super(sb, data, silent, &vfat_dir_inode_operations, 1); | 1060 | res = fat_fill_super(sb, data, silent, &vfat_dir_inode_operations, 1); |
1059 | if (res) | 1061 | if (res) { |
1062 | unlock_kernel(); | ||
1060 | return res; | 1063 | return res; |
1064 | } | ||
1061 | 1065 | ||
1062 | if (MSDOS_SB(sb)->options.name_check != 's') | 1066 | if (MSDOS_SB(sb)->options.name_check != 's') |
1063 | sb->s_root->d_op = &vfat_ci_dentry_ops; | 1067 | sb->s_root->d_op = &vfat_ci_dentry_ops; |
1064 | else | 1068 | else |
1065 | sb->s_root->d_op = &vfat_dentry_ops; | 1069 | sb->s_root->d_op = &vfat_dentry_ops; |
1066 | 1070 | ||
1071 | unlock_kernel(); | ||
1067 | return 0; | 1072 | return 0; |
1068 | } | 1073 | } |
1069 | 1074 | ||
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index dc0c041e85cb..eb2b9e09c996 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c | |||
@@ -148,7 +148,7 @@ static int vxfs_remount(struct super_block *sb, int *flags, char *data) | |||
148 | * The superblock on success, else %NULL. | 148 | * The superblock on success, else %NULL. |
149 | * | 149 | * |
150 | * Locking: | 150 | * Locking: |
151 | * We are under the bkl and @sbp->s_lock. | 151 | * We are under @sbp->s_lock. |
152 | */ | 152 | */ |
153 | static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) | 153 | static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) |
154 | { | 154 | { |
@@ -159,11 +159,14 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) | |||
159 | struct inode *root; | 159 | struct inode *root; |
160 | int ret = -EINVAL; | 160 | int ret = -EINVAL; |
161 | 161 | ||
162 | lock_kernel(); | ||
163 | |||
162 | sbp->s_flags |= MS_RDONLY; | 164 | sbp->s_flags |= MS_RDONLY; |
163 | 165 | ||
164 | infp = kzalloc(sizeof(*infp), GFP_KERNEL); | 166 | infp = kzalloc(sizeof(*infp), GFP_KERNEL); |
165 | if (!infp) { | 167 | if (!infp) { |
166 | printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n"); | 168 | printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n"); |
169 | unlock_kernel(); | ||
167 | return -ENOMEM; | 170 | return -ENOMEM; |
168 | } | 171 | } |
169 | 172 | ||
@@ -236,6 +239,7 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) | |||
236 | goto out_free_ilist; | 239 | goto out_free_ilist; |
237 | } | 240 | } |
238 | 241 | ||
242 | unlock_kernel(); | ||
239 | return 0; | 243 | return 0; |
240 | 244 | ||
241 | out_free_ilist: | 245 | out_free_ilist: |
@@ -245,6 +249,7 @@ out_free_ilist: | |||
245 | out: | 249 | out: |
246 | brelse(bp); | 250 | brelse(bp); |
247 | kfree(infp); | 251 | kfree(infp); |
252 | unlock_kernel(); | ||
248 | return ret; | 253 | return ret; |
249 | } | 254 | } |
250 | 255 | ||
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index 34235d4bf08b..3069416fa8ef 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -382,9 +382,13 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) | |||
382 | struct inode *root_inode; | 382 | struct inode *root_inode; |
383 | int res; | 383 | int res; |
384 | 384 | ||
385 | lock_kernel(); | ||
386 | |||
385 | sbi = kzalloc(sizeof(struct hfs_sb_info), GFP_KERNEL); | 387 | sbi = kzalloc(sizeof(struct hfs_sb_info), GFP_KERNEL); |
386 | if (!sbi) | 388 | if (!sbi) { |
389 | unlock_kernel(); | ||
387 | return -ENOMEM; | 390 | return -ENOMEM; |
391 | } | ||
388 | sb->s_fs_info = sbi; | 392 | sb->s_fs_info = sbi; |
389 | INIT_HLIST_HEAD(&sbi->rsrc_inodes); | 393 | INIT_HLIST_HEAD(&sbi->rsrc_inodes); |
390 | 394 | ||
@@ -435,6 +439,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) | |||
435 | sb->s_root->d_op = &hfs_dentry_operations; | 439 | sb->s_root->d_op = &hfs_dentry_operations; |
436 | 440 | ||
437 | /* everything's okay */ | 441 | /* everything's okay */ |
442 | unlock_kernel(); | ||
438 | return 0; | 443 | return 0; |
439 | 444 | ||
440 | bail_iput: | 445 | bail_iput: |
@@ -443,6 +448,7 @@ bail_no_root: | |||
443 | printk(KERN_ERR "hfs: get root inode failed.\n"); | 448 | printk(KERN_ERR "hfs: get root inode failed.\n"); |
444 | bail: | 449 | bail: |
445 | hfs_mdb_put(sb); | 450 | hfs_mdb_put(sb); |
451 | unlock_kernel(); | ||
446 | return res; | 452 | return res; |
447 | } | 453 | } |
448 | 454 | ||
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index 2607010be2fe..c969a1aa163a 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -477,11 +477,15 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
477 | 477 | ||
478 | int o; | 478 | int o; |
479 | 479 | ||
480 | lock_kernel(); | ||
481 | |||
480 | save_mount_options(s, options); | 482 | save_mount_options(s, options); |
481 | 483 | ||
482 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | 484 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); |
483 | if (!sbi) | 485 | if (!sbi) { |
486 | unlock_kernel(); | ||
484 | return -ENOMEM; | 487 | return -ENOMEM; |
488 | } | ||
485 | s->s_fs_info = sbi; | 489 | s->s_fs_info = sbi; |
486 | 490 | ||
487 | sbi->sb_bmp_dir = NULL; | 491 | sbi->sb_bmp_dir = NULL; |
@@ -666,6 +670,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
666 | root->i_blocks = 5; | 670 | root->i_blocks = 5; |
667 | hpfs_brelse4(&qbh); | 671 | hpfs_brelse4(&qbh); |
668 | } | 672 | } |
673 | unlock_kernel(); | ||
669 | return 0; | 674 | return 0; |
670 | 675 | ||
671 | bail4: brelse(bh2); | 676 | bail4: brelse(bh2); |
@@ -677,6 +682,7 @@ bail0: | |||
677 | kfree(sbi->sb_cp_table); | 682 | kfree(sbi->sb_cp_table); |
678 | s->s_fs_info = NULL; | 683 | s->s_fs_info = NULL; |
679 | kfree(sbi); | 684 | kfree(sbi); |
685 | unlock_kernel(); | ||
680 | return -EINVAL; | 686 | return -EINVAL; |
681 | } | 687 | } |
682 | 688 | ||
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 5a44811b5027..05baf7721e8c 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -571,11 +571,15 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) | |||
571 | int table, error = -EINVAL; | 571 | int table, error = -EINVAL; |
572 | unsigned int vol_desc_start; | 572 | unsigned int vol_desc_start; |
573 | 573 | ||
574 | lock_kernel(); | ||
575 | |||
574 | save_mount_options(s, data); | 576 | save_mount_options(s, data); |
575 | 577 | ||
576 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | 578 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); |
577 | if (!sbi) | 579 | if (!sbi) { |
580 | unlock_kernel(); | ||
578 | return -ENOMEM; | 581 | return -ENOMEM; |
582 | } | ||
579 | s->s_fs_info = sbi; | 583 | s->s_fs_info = sbi; |
580 | 584 | ||
581 | if (!parse_options((char *)data, &opt)) | 585 | if (!parse_options((char *)data, &opt)) |
@@ -900,6 +904,7 @@ root_found: | |||
900 | 904 | ||
901 | kfree(opt.iocharset); | 905 | kfree(opt.iocharset); |
902 | 906 | ||
907 | unlock_kernel(); | ||
903 | return 0; | 908 | return 0; |
904 | 909 | ||
905 | /* | 910 | /* |
@@ -939,6 +944,7 @@ out_freesbi: | |||
939 | kfree(opt.iocharset); | 944 | kfree(opt.iocharset); |
940 | kfree(sbi); | 945 | kfree(sbi); |
941 | s->s_fs_info = NULL; | 946 | s->s_fs_info = NULL; |
947 | unlock_kernel(); | ||
942 | return error; | 948 | return error; |
943 | } | 949 | } |
944 | 950 | ||
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 662bba099501..58dd9cf06206 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -146,14 +146,19 @@ static const struct super_operations jffs2_super_operations = | |||
146 | static int jffs2_fill_super(struct super_block *sb, void *data, int silent) | 146 | static int jffs2_fill_super(struct super_block *sb, void *data, int silent) |
147 | { | 147 | { |
148 | struct jffs2_sb_info *c; | 148 | struct jffs2_sb_info *c; |
149 | int ret; | ||
150 | |||
151 | lock_kernel(); | ||
149 | 152 | ||
150 | D1(printk(KERN_DEBUG "jffs2_get_sb_mtd():" | 153 | D1(printk(KERN_DEBUG "jffs2_get_sb_mtd():" |
151 | " New superblock for device %d (\"%s\")\n", | 154 | " New superblock for device %d (\"%s\")\n", |
152 | sb->s_mtd->index, sb->s_mtd->name)); | 155 | sb->s_mtd->index, sb->s_mtd->name)); |
153 | 156 | ||
154 | c = kzalloc(sizeof(*c), GFP_KERNEL); | 157 | c = kzalloc(sizeof(*c), GFP_KERNEL); |
155 | if (!c) | 158 | if (!c) { |
159 | unlock_kernel(); | ||
156 | return -ENOMEM; | 160 | return -ENOMEM; |
161 | } | ||
157 | 162 | ||
158 | c->mtd = sb->s_mtd; | 163 | c->mtd = sb->s_mtd; |
159 | c->os_priv = sb; | 164 | c->os_priv = sb; |
@@ -175,7 +180,9 @@ static int jffs2_fill_super(struct super_block *sb, void *data, int silent) | |||
175 | #ifdef CONFIG_JFFS2_FS_POSIX_ACL | 180 | #ifdef CONFIG_JFFS2_FS_POSIX_ACL |
176 | sb->s_flags |= MS_POSIXACL; | 181 | sb->s_flags |= MS_POSIXACL; |
177 | #endif | 182 | #endif |
178 | return jffs2_do_fill_super(sb, data, silent); | 183 | ret = jffs2_do_fill_super(sb, data, silent); |
184 | unlock_kernel(); | ||
185 | return ret; | ||
179 | } | 186 | } |
180 | 187 | ||
181 | static int jffs2_get_sb(struct file_system_type *fs_type, | 188 | static int jffs2_get_sb(struct file_system_type *fs_type, |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index ec8c3e4baca3..eb31f677347d 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -438,14 +438,20 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | |||
438 | s64 newLVSize = 0; | 438 | s64 newLVSize = 0; |
439 | int flag, ret = -EINVAL; | 439 | int flag, ret = -EINVAL; |
440 | 440 | ||
441 | lock_kernel(); | ||
442 | |||
441 | jfs_info("In jfs_read_super: s_flags=0x%lx", sb->s_flags); | 443 | jfs_info("In jfs_read_super: s_flags=0x%lx", sb->s_flags); |
442 | 444 | ||
443 | if (!new_valid_dev(sb->s_bdev->bd_dev)) | 445 | if (!new_valid_dev(sb->s_bdev->bd_dev)) { |
446 | unlock_kernel(); | ||
444 | return -EOVERFLOW; | 447 | return -EOVERFLOW; |
448 | } | ||
445 | 449 | ||
446 | sbi = kzalloc(sizeof (struct jfs_sb_info), GFP_KERNEL); | 450 | sbi = kzalloc(sizeof (struct jfs_sb_info), GFP_KERNEL); |
447 | if (!sbi) | 451 | if (!sbi) { |
452 | unlock_kernel(); | ||
448 | return -ENOMEM; | 453 | return -ENOMEM; |
454 | } | ||
449 | sb->s_fs_info = sbi; | 455 | sb->s_fs_info = sbi; |
450 | sbi->sb = sb; | 456 | sbi->sb = sb; |
451 | sbi->uid = sbi->gid = sbi->umask = -1; | 457 | sbi->uid = sbi->gid = sbi->umask = -1; |
@@ -542,6 +548,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | |||
542 | sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, (u64)sb->s_maxbytes); | 548 | sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, (u64)sb->s_maxbytes); |
543 | #endif | 549 | #endif |
544 | sb->s_time_gran = 1; | 550 | sb->s_time_gran = 1; |
551 | unlock_kernel(); | ||
545 | return 0; | 552 | return 0; |
546 | 553 | ||
547 | out_no_root: | 554 | out_no_root: |
@@ -564,6 +571,7 @@ out_unload: | |||
564 | unload_nls(sbi->nls_tab); | 571 | unload_nls(sbi->nls_tab); |
565 | out_kfree: | 572 | out_kfree: |
566 | kfree(sbi); | 573 | kfree(sbi); |
574 | unlock_kernel(); | ||
567 | return ret; | 575 | return ret; |
568 | } | 576 | } |
569 | 577 | ||
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 922263393c76..0d573c2a6860 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -1113,9 +1113,12 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags, | |||
1113 | if (!(flags & MS_RDONLY)) | 1113 | if (!(flags & MS_RDONLY)) |
1114 | mode |= FMODE_WRITE; | 1114 | mode |= FMODE_WRITE; |
1115 | 1115 | ||
1116 | lock_kernel(); | ||
1116 | sd.bdev = open_bdev_exclusive(dev_name, mode, fs_type); | 1117 | sd.bdev = open_bdev_exclusive(dev_name, mode, fs_type); |
1117 | if (IS_ERR(sd.bdev)) | 1118 | if (IS_ERR(sd.bdev)) { |
1119 | unlock_kernel(); | ||
1118 | return PTR_ERR(sd.bdev); | 1120 | return PTR_ERR(sd.bdev); |
1121 | } | ||
1119 | 1122 | ||
1120 | /* | 1123 | /* |
1121 | * To get mount instance using sget() vfs-routine, NILFS needs | 1124 | * To get mount instance using sget() vfs-routine, NILFS needs |
@@ -1198,6 +1201,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags, | |||
1198 | if (need_to_close) | 1201 | if (need_to_close) |
1199 | close_bdev_exclusive(sd.bdev, mode); | 1202 | close_bdev_exclusive(sd.bdev, mode); |
1200 | simple_set_mnt(mnt, s); | 1203 | simple_set_mnt(mnt, s); |
1204 | unlock_kernel(); | ||
1201 | return 0; | 1205 | return 0; |
1202 | 1206 | ||
1203 | failed_unlock: | 1207 | failed_unlock: |
@@ -1206,6 +1210,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags, | |||
1206 | failed: | 1210 | failed: |
1207 | close_bdev_exclusive(sd.bdev, mode); | 1211 | close_bdev_exclusive(sd.bdev, mode); |
1208 | 1212 | ||
1213 | unlock_kernel(); | ||
1209 | return err; | 1214 | return err; |
1210 | 1215 | ||
1211 | cancel_new: | 1216 | cancel_new: |
@@ -1218,6 +1223,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags, | |||
1218 | * We must finish all post-cleaning before this call; | 1223 | * We must finish all post-cleaning before this call; |
1219 | * put_nilfs() needs the block device. | 1224 | * put_nilfs() needs the block device. |
1220 | */ | 1225 | */ |
1226 | unlock_kernel(); | ||
1221 | return err; | 1227 | return err; |
1222 | } | 1228 | } |
1223 | 1229 | ||
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 512806171bfa..1f31e77fc41f 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -2732,6 +2732,8 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) | |||
2732 | struct inode *tmp_ino; | 2732 | struct inode *tmp_ino; |
2733 | int blocksize, result; | 2733 | int blocksize, result; |
2734 | 2734 | ||
2735 | lock_kernel(); | ||
2736 | |||
2735 | /* | 2737 | /* |
2736 | * We do a pretty difficult piece of bootstrap by reading the | 2738 | * We do a pretty difficult piece of bootstrap by reading the |
2737 | * MFT (and other metadata) from disk into memory. We'll only | 2739 | * MFT (and other metadata) from disk into memory. We'll only |
@@ -2755,6 +2757,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) | |||
2755 | ntfs_error(sb, "Allocation of NTFS volume structure " | 2757 | ntfs_error(sb, "Allocation of NTFS volume structure " |
2756 | "failed. Aborting mount..."); | 2758 | "failed. Aborting mount..."); |
2757 | lockdep_on(); | 2759 | lockdep_on(); |
2760 | unlock_kernel(); | ||
2758 | return -ENOMEM; | 2761 | return -ENOMEM; |
2759 | } | 2762 | } |
2760 | /* Initialize ntfs_volume structure. */ | 2763 | /* Initialize ntfs_volume structure. */ |
@@ -2942,6 +2945,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) | |||
2942 | sb->s_export_op = &ntfs_export_ops; | 2945 | sb->s_export_op = &ntfs_export_ops; |
2943 | lock_kernel(); | 2946 | lock_kernel(); |
2944 | lockdep_on(); | 2947 | lockdep_on(); |
2948 | unlock_kernel(); | ||
2945 | return 0; | 2949 | return 0; |
2946 | } | 2950 | } |
2947 | ntfs_error(sb, "Failed to allocate root directory."); | 2951 | ntfs_error(sb, "Failed to allocate root directory."); |
@@ -3062,6 +3066,7 @@ err_out_now: | |||
3062 | kfree(vol); | 3066 | kfree(vol); |
3063 | ntfs_debug("Failed, returning -EINVAL."); | 3067 | ntfs_debug("Failed, returning -EINVAL."); |
3064 | lockdep_on(); | 3068 | lockdep_on(); |
3069 | unlock_kernel(); | ||
3065 | return -EINVAL; | 3070 | return -EINVAL; |
3066 | } | 3071 | } |
3067 | 3072 | ||
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c index c2903b84bb7a..667d7ceba8c9 100644 --- a/fs/ocfs2/dlmfs/dlmfs.c +++ b/fs/ocfs2/dlmfs/dlmfs.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/string.h> | 44 | #include <linux/string.h> |
45 | #include <linux/backing-dev.h> | 45 | #include <linux/backing-dev.h> |
46 | #include <linux/poll.h> | 46 | #include <linux/poll.h> |
47 | #include <linux/smp_lock.h> | ||
47 | 48 | ||
48 | #include <asm/uaccess.h> | 49 | #include <asm/uaccess.h> |
49 | 50 | ||
@@ -588,21 +589,27 @@ static int dlmfs_fill_super(struct super_block * sb, | |||
588 | struct inode * inode; | 589 | struct inode * inode; |
589 | struct dentry * root; | 590 | struct dentry * root; |
590 | 591 | ||
592 | lock_kernel(); | ||
593 | |||
591 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 594 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
592 | sb->s_blocksize = PAGE_CACHE_SIZE; | 595 | sb->s_blocksize = PAGE_CACHE_SIZE; |
593 | sb->s_blocksize_bits = PAGE_CACHE_SHIFT; | 596 | sb->s_blocksize_bits = PAGE_CACHE_SHIFT; |
594 | sb->s_magic = DLMFS_MAGIC; | 597 | sb->s_magic = DLMFS_MAGIC; |
595 | sb->s_op = &dlmfs_ops; | 598 | sb->s_op = &dlmfs_ops; |
596 | inode = dlmfs_get_root_inode(sb); | 599 | inode = dlmfs_get_root_inode(sb); |
597 | if (!inode) | 600 | if (!inode) { |
601 | unlock_kernel(); | ||
598 | return -ENOMEM; | 602 | return -ENOMEM; |
603 | } | ||
599 | 604 | ||
600 | root = d_alloc_root(inode); | 605 | root = d_alloc_root(inode); |
601 | if (!root) { | 606 | if (!root) { |
602 | iput(inode); | 607 | iput(inode); |
608 | unlock_kernel(); | ||
603 | return -ENOMEM; | 609 | return -ENOMEM; |
604 | } | 610 | } |
605 | sb->s_root = root; | 611 | sb->s_root = root; |
612 | unlock_kernel(); | ||
606 | return 0; | 613 | return 0; |
607 | } | 614 | } |
608 | 615 | ||
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index fa1be1b304d1..b7e4f2d19d40 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -1002,6 +1002,8 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
1002 | char nodestr[8]; | 1002 | char nodestr[8]; |
1003 | struct ocfs2_blockcheck_stats stats; | 1003 | struct ocfs2_blockcheck_stats stats; |
1004 | 1004 | ||
1005 | lock_kernel(); | ||
1006 | |||
1005 | mlog_entry("%p, %p, %i", sb, data, silent); | 1007 | mlog_entry("%p, %p, %i", sb, data, silent); |
1006 | 1008 | ||
1007 | if (!ocfs2_parse_options(sb, data, &parsed_options, 0)) { | 1009 | if (!ocfs2_parse_options(sb, data, &parsed_options, 0)) { |
@@ -1179,6 +1181,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
1179 | atomic_set(&osb->vol_state, VOLUME_DISABLED); | 1181 | atomic_set(&osb->vol_state, VOLUME_DISABLED); |
1180 | wake_up(&osb->osb_mount_event); | 1182 | wake_up(&osb->osb_mount_event); |
1181 | mlog_exit(status); | 1183 | mlog_exit(status); |
1184 | unlock_kernel(); | ||
1182 | return status; | 1185 | return status; |
1183 | } | 1186 | } |
1184 | } | 1187 | } |
@@ -1193,6 +1196,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
1193 | ocfs2_orphan_scan_start(osb); | 1196 | ocfs2_orphan_scan_start(osb); |
1194 | 1197 | ||
1195 | mlog_exit(status); | 1198 | mlog_exit(status); |
1199 | unlock_kernel(); | ||
1196 | return status; | 1200 | return status; |
1197 | 1201 | ||
1198 | read_super_error: | 1202 | read_super_error: |
@@ -1208,6 +1212,7 @@ read_super_error: | |||
1208 | } | 1212 | } |
1209 | 1213 | ||
1210 | mlog_exit(status); | 1214 | mlog_exit(status); |
1215 | unlock_kernel(); | ||
1211 | return status; | 1216 | return status; |
1212 | } | 1217 | } |
1213 | 1218 | ||
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c index 16829722be93..86a7be1399a8 100644 --- a/fs/qnx4/inode.c +++ b/fs/qnx4/inode.c | |||
@@ -234,9 +234,13 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent) | |||
234 | struct qnx4_sb_info *qs; | 234 | struct qnx4_sb_info *qs; |
235 | int ret = -EINVAL; | 235 | int ret = -EINVAL; |
236 | 236 | ||
237 | lock_kernel(); | ||
238 | |||
237 | qs = kzalloc(sizeof(struct qnx4_sb_info), GFP_KERNEL); | 239 | qs = kzalloc(sizeof(struct qnx4_sb_info), GFP_KERNEL); |
238 | if (!qs) | 240 | if (!qs) { |
241 | unlock_kernel(); | ||
239 | return -ENOMEM; | 242 | return -ENOMEM; |
243 | } | ||
240 | s->s_fs_info = qs; | 244 | s->s_fs_info = qs; |
241 | 245 | ||
242 | sb_set_blocksize(s, QNX4_BLOCK_SIZE); | 246 | sb_set_blocksize(s, QNX4_BLOCK_SIZE); |
@@ -284,6 +288,7 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent) | |||
284 | 288 | ||
285 | brelse(bh); | 289 | brelse(bh); |
286 | 290 | ||
291 | unlock_kernel(); | ||
287 | return 0; | 292 | return 0; |
288 | 293 | ||
289 | outi: | 294 | outi: |
@@ -293,6 +298,7 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent) | |||
293 | outnobh: | 298 | outnobh: |
294 | kfree(qs); | 299 | kfree(qs); |
295 | s->s_fs_info = NULL; | 300 | s->s_fs_info = NULL; |
301 | unlock_kernel(); | ||
296 | return ret; | 302 | return ret; |
297 | } | 303 | } |
298 | 304 | ||
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index 450c91941988..8fc5e50e142f 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c | |||
@@ -501,6 +501,8 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
501 | void *mem; | 501 | void *mem; |
502 | static int warn_count; | 502 | static int warn_count; |
503 | 503 | ||
504 | lock_kernel(); | ||
505 | |||
504 | if (warn_count < 5) { | 506 | if (warn_count < 5) { |
505 | warn_count++; | 507 | warn_count++; |
506 | printk(KERN_EMERG "smbfs is deprecated and will be removed" | 508 | printk(KERN_EMERG "smbfs is deprecated and will be removed" |
@@ -621,6 +623,7 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
621 | 623 | ||
622 | smb_new_dentry(sb->s_root); | 624 | smb_new_dentry(sb->s_root); |
623 | 625 | ||
626 | unlock_kernel(); | ||
624 | return 0; | 627 | return 0; |
625 | 628 | ||
626 | out_no_root: | 629 | out_no_root: |
@@ -643,9 +646,11 @@ out_wrong_data: | |||
643 | out_no_data: | 646 | out_no_data: |
644 | printk(KERN_ERR "smb_fill_super: missing data argument\n"); | 647 | printk(KERN_ERR "smb_fill_super: missing data argument\n"); |
645 | out_fail: | 648 | out_fail: |
649 | unlock_kernel(); | ||
646 | return -EINVAL; | 650 | return -EINVAL; |
647 | out_no_server: | 651 | out_no_server: |
648 | printk(KERN_ERR "smb_fill_super: cannot allocate struct smb_sb_info\n"); | 652 | printk(KERN_ERR "smb_fill_super: cannot allocate struct smb_sb_info\n"); |
653 | unlock_kernel(); | ||
649 | return -ENOMEM; | 654 | return -ENOMEM; |
650 | } | 655 | } |
651 | 656 | ||
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c index 88b4f8606652..ab1a401a0e19 100644 --- a/fs/squashfs/super.c +++ b/fs/squashfs/super.c | |||
@@ -87,11 +87,14 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent) | |||
87 | u64 lookup_table_start, xattr_id_table_start; | 87 | u64 lookup_table_start, xattr_id_table_start; |
88 | int err; | 88 | int err; |
89 | 89 | ||
90 | lock_kernel(); | ||
91 | |||
90 | TRACE("Entered squashfs_fill_superblock\n"); | 92 | TRACE("Entered squashfs_fill_superblock\n"); |
91 | 93 | ||
92 | sb->s_fs_info = kzalloc(sizeof(*msblk), GFP_KERNEL); | 94 | sb->s_fs_info = kzalloc(sizeof(*msblk), GFP_KERNEL); |
93 | if (sb->s_fs_info == NULL) { | 95 | if (sb->s_fs_info == NULL) { |
94 | ERROR("Failed to allocate squashfs_sb_info\n"); | 96 | ERROR("Failed to allocate squashfs_sb_info\n"); |
97 | unlock_kernel(); | ||
95 | return -ENOMEM; | 98 | return -ENOMEM; |
96 | } | 99 | } |
97 | msblk = sb->s_fs_info; | 100 | msblk = sb->s_fs_info; |
@@ -301,6 +304,7 @@ allocate_root: | |||
301 | 304 | ||
302 | TRACE("Leaving squashfs_fill_super\n"); | 305 | TRACE("Leaving squashfs_fill_super\n"); |
303 | kfree(sblk); | 306 | kfree(sblk); |
307 | unlock_kernel(); | ||
304 | return 0; | 308 | return 0; |
305 | 309 | ||
306 | failed_mount: | 310 | failed_mount: |
@@ -315,11 +319,13 @@ failed_mount: | |||
315 | kfree(sb->s_fs_info); | 319 | kfree(sb->s_fs_info); |
316 | sb->s_fs_info = NULL; | 320 | sb->s_fs_info = NULL; |
317 | kfree(sblk); | 321 | kfree(sblk); |
322 | unlock_kernel(); | ||
318 | return err; | 323 | return err; |
319 | 324 | ||
320 | failure: | 325 | failure: |
321 | kfree(sb->s_fs_info); | 326 | kfree(sb->s_fs_info); |
322 | sb->s_fs_info = NULL; | 327 | sb->s_fs_info = NULL; |
328 | unlock_kernel(); | ||
323 | return -ENOMEM; | 329 | return -ENOMEM; |
324 | } | 330 | } |
325 | 331 | ||
diff --git a/fs/udf/super.c b/fs/udf/super.c index 65412d84a45d..76f3d6d97b40 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -1880,6 +1880,8 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1880 | struct kernel_lb_addr rootdir, fileset; | 1880 | struct kernel_lb_addr rootdir, fileset; |
1881 | struct udf_sb_info *sbi; | 1881 | struct udf_sb_info *sbi; |
1882 | 1882 | ||
1883 | lock_kernel(); | ||
1884 | |||
1883 | uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT); | 1885 | uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT); |
1884 | uopt.uid = -1; | 1886 | uopt.uid = -1; |
1885 | uopt.gid = -1; | 1887 | uopt.gid = -1; |
@@ -1888,8 +1890,10 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1888 | uopt.dmode = UDF_INVALID_MODE; | 1890 | uopt.dmode = UDF_INVALID_MODE; |
1889 | 1891 | ||
1890 | sbi = kzalloc(sizeof(struct udf_sb_info), GFP_KERNEL); | 1892 | sbi = kzalloc(sizeof(struct udf_sb_info), GFP_KERNEL); |
1891 | if (!sbi) | 1893 | if (!sbi) { |
1894 | unlock_kernel(); | ||
1892 | return -ENOMEM; | 1895 | return -ENOMEM; |
1896 | } | ||
1893 | 1897 | ||
1894 | sb->s_fs_info = sbi; | 1898 | sb->s_fs_info = sbi; |
1895 | 1899 | ||
@@ -2035,6 +2039,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
2035 | goto error_out; | 2039 | goto error_out; |
2036 | } | 2040 | } |
2037 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 2041 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
2042 | unlock_kernel(); | ||
2038 | return 0; | 2043 | return 0; |
2039 | 2044 | ||
2040 | error_out: | 2045 | error_out: |
@@ -2055,6 +2060,7 @@ error_out: | |||
2055 | kfree(sbi); | 2060 | kfree(sbi); |
2056 | sb->s_fs_info = NULL; | 2061 | sb->s_fs_info = NULL; |
2057 | 2062 | ||
2063 | unlock_kernel(); | ||
2058 | return -EINVAL; | 2064 | return -EINVAL; |
2059 | } | 2065 | } |
2060 | 2066 | ||
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index d510c1b91817..6b9be90dae7d 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -696,6 +696,8 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
696 | unsigned maxsymlen; | 696 | unsigned maxsymlen; |
697 | int ret = -EINVAL; | 697 | int ret = -EINVAL; |
698 | 698 | ||
699 | lock_kernel(); | ||
700 | |||
699 | uspi = NULL; | 701 | uspi = NULL; |
700 | ubh = NULL; | 702 | ubh = NULL; |
701 | flags = 0; | 703 | flags = 0; |
@@ -1163,6 +1165,7 @@ magic_found: | |||
1163 | goto failed; | 1165 | goto failed; |
1164 | 1166 | ||
1165 | UFSD("EXIT\n"); | 1167 | UFSD("EXIT\n"); |
1168 | unlock_kernel(); | ||
1166 | return 0; | 1169 | return 0; |
1167 | 1170 | ||
1168 | dalloc_failed: | 1171 | dalloc_failed: |
@@ -1174,10 +1177,12 @@ failed: | |||
1174 | kfree(sbi); | 1177 | kfree(sbi); |
1175 | sb->s_fs_info = NULL; | 1178 | sb->s_fs_info = NULL; |
1176 | UFSD("EXIT (FAILED)\n"); | 1179 | UFSD("EXIT (FAILED)\n"); |
1180 | unlock_kernel(); | ||
1177 | return ret; | 1181 | return ret; |
1178 | 1182 | ||
1179 | failed_nomem: | 1183 | failed_nomem: |
1180 | UFSD("EXIT (NOMEM)\n"); | 1184 | UFSD("EXIT (NOMEM)\n"); |
1185 | unlock_kernel(); | ||
1181 | return -ENOMEM; | 1186 | return -ENOMEM; |
1182 | } | 1187 | } |
1183 | 1188 | ||
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index c9483d8f6140..a7ba3bccadc5 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1430,6 +1430,8 @@ static int cgroup_get_sb(struct file_system_type *fs_type, | |||
1430 | struct super_block *sb; | 1430 | struct super_block *sb; |
1431 | struct cgroupfs_root *new_root; | 1431 | struct cgroupfs_root *new_root; |
1432 | 1432 | ||
1433 | lock_kernel(); | ||
1434 | |||
1433 | /* First find the desired set of subsystems */ | 1435 | /* First find the desired set of subsystems */ |
1434 | mutex_lock(&cgroup_mutex); | 1436 | mutex_lock(&cgroup_mutex); |
1435 | ret = parse_cgroupfs_options(data, &opts); | 1437 | ret = parse_cgroupfs_options(data, &opts); |
@@ -1559,6 +1561,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type, | |||
1559 | simple_set_mnt(mnt, sb); | 1561 | simple_set_mnt(mnt, sb); |
1560 | kfree(opts.release_agent); | 1562 | kfree(opts.release_agent); |
1561 | kfree(opts.name); | 1563 | kfree(opts.name); |
1564 | unlock_kernel(); | ||
1562 | return 0; | 1565 | return 0; |
1563 | 1566 | ||
1564 | drop_new_super: | 1567 | drop_new_super: |
@@ -1568,6 +1571,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type, | |||
1568 | out_err: | 1571 | out_err: |
1569 | kfree(opts.release_agent); | 1572 | kfree(opts.release_agent); |
1570 | kfree(opts.name); | 1573 | kfree(opts.name); |
1574 | unlock_kernel(); | ||
1571 | 1575 | ||
1572 | return ret; | 1576 | return ret; |
1573 | } | 1577 | } |