aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlessio Igor Bogani <abogani@texware.it>2009-05-12 09:10:54 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-06-11 21:36:11 -0400
commit337eb00a2c3a421999c39c94ce7e33545ee8baa7 (patch)
treed9b780d095b638b1d8fa23841ff70347cf5daa08
parent4195f73d1329e49727bcceb028e58cb38376c2b0 (diff)
Push BKL down into ->remount_fs()
[xfs, btrfs, capifs, shmem don't need BKL, exempt] Signed-off-by: Alessio Igor Bogani <abogani@texware.it> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--drivers/usb/core/inode.c5
-rw-r--r--fs/affs/super.c7
-rw-r--r--fs/ext2/super.c12
-rw-r--r--fs/ext3/super.c4
-rw-r--r--fs/ext4/super.c4
-rw-r--r--fs/hpfs/super.c4
-rw-r--r--fs/jffs2/fs.c3
-rw-r--r--fs/jfs/super.c22
-rw-r--r--fs/nfs/super.c2
-rw-r--r--fs/nilfs2/super.c4
-rw-r--r--fs/ntfs/super.c15
-rw-r--r--fs/ocfs2/super.c4
-rw-r--r--fs/reiserfs/super.c4
-rw-r--r--fs/super.c2
-rw-r--r--fs/ubifs/super.c9
-rw-r--r--fs/udf/super.c6
-rw-r--r--fs/ufs/super.c11
-rw-r--r--kernel/cgroup.c3
18 files changed, 108 insertions, 13 deletions
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index dff5760a37f6..ffe75e83787c 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -39,6 +39,7 @@
39#include <linux/parser.h> 39#include <linux/parser.h>
40#include <linux/notifier.h> 40#include <linux/notifier.h>
41#include <linux/seq_file.h> 41#include <linux/seq_file.h>
42#include <linux/smp_lock.h>
42#include <asm/byteorder.h> 43#include <asm/byteorder.h>
43#include "usb.h" 44#include "usb.h"
44#include "hcd.h" 45#include "hcd.h"
@@ -265,9 +266,13 @@ static int remount(struct super_block *sb, int *flags, char *data)
265 return -EINVAL; 266 return -EINVAL;
266 } 267 }
267 268
269 lock_kernel();
270
268 if (usbfs_mount && usbfs_mount->mnt_sb) 271 if (usbfs_mount && usbfs_mount->mnt_sb)
269 update_sb(usbfs_mount->mnt_sb); 272 update_sb(usbfs_mount->mnt_sb);
270 273
274 unlock_kernel();
275
271 return 0; 276 return 0;
272} 277}
273 278
diff --git a/fs/affs/super.c b/fs/affs/super.c
index 280d361af41f..c4814937c968 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -16,6 +16,7 @@
16#include <linux/parser.h> 16#include <linux/parser.h>
17#include <linux/magic.h> 17#include <linux/magic.h>
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/smp_lock.h>
19#include "affs.h" 20#include "affs.h"
20 21
21extern struct timezone sys_tz; 22extern struct timezone sys_tz;
@@ -512,6 +513,7 @@ affs_remount(struct super_block *sb, int *flags, char *data)
512 kfree(new_opts); 513 kfree(new_opts);
513 return -EINVAL; 514 return -EINVAL;
514 } 515 }
516 lock_kernel();
515 replace_mount_options(sb, new_opts); 517 replace_mount_options(sb, new_opts);
516 518
517 sbi->s_flags = mount_flags; 519 sbi->s_flags = mount_flags;
@@ -519,8 +521,10 @@ affs_remount(struct super_block *sb, int *flags, char *data)
519 sbi->s_uid = uid; 521 sbi->s_uid = uid;
520 sbi->s_gid = gid; 522 sbi->s_gid = gid;
521 523
522 if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) 524 if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
525 unlock_kernel();
523 return 0; 526 return 0;
527 }
524 if (*flags & MS_RDONLY) { 528 if (*flags & MS_RDONLY) {
525 sb->s_dirt = 1; 529 sb->s_dirt = 1;
526 while (sb->s_dirt) 530 while (sb->s_dirt)
@@ -529,6 +533,7 @@ affs_remount(struct super_block *sb, int *flags, char *data)
529 } else 533 } else
530 res = affs_init_bitmap(sb, flags); 534 res = affs_init_bitmap(sb, flags);
531 535
536 unlock_kernel();
532 return res; 537 return res;
533} 538}
534 539
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index a44963d8edbd..f8cbdf569190 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1162,6 +1162,8 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
1162 unsigned long old_sb_flags; 1162 unsigned long old_sb_flags;
1163 int err; 1163 int err;
1164 1164
1165 lock_kernel();
1166
1165 /* Store the old options */ 1167 /* Store the old options */
1166 old_sb_flags = sb->s_flags; 1168 old_sb_flags = sb->s_flags;
1167 old_opts.s_mount_opt = sbi->s_mount_opt; 1169 old_opts.s_mount_opt = sbi->s_mount_opt;
@@ -1197,12 +1199,16 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
1197 sbi->s_mount_opt &= ~EXT2_MOUNT_XIP; 1199 sbi->s_mount_opt &= ~EXT2_MOUNT_XIP;
1198 sbi->s_mount_opt |= old_mount_opt & EXT2_MOUNT_XIP; 1200 sbi->s_mount_opt |= old_mount_opt & EXT2_MOUNT_XIP;
1199 } 1201 }
1200 if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) 1202 if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
1203 unlock_kernel();
1201 return 0; 1204 return 0;
1205 }
1202 if (*flags & MS_RDONLY) { 1206 if (*flags & MS_RDONLY) {
1203 if (le16_to_cpu(es->s_state) & EXT2_VALID_FS || 1207 if (le16_to_cpu(es->s_state) & EXT2_VALID_FS ||
1204 !(sbi->s_mount_state & EXT2_VALID_FS)) 1208 !(sbi->s_mount_state & EXT2_VALID_FS)) {
1209 unlock_kernel();
1205 return 0; 1210 return 0;
1211 }
1206 /* 1212 /*
1207 * OK, we are remounting a valid rw partition rdonly, so set 1213 * OK, we are remounting a valid rw partition rdonly, so set
1208 * the rdonly flag and then mark the partition as valid again. 1214 * the rdonly flag and then mark the partition as valid again.
@@ -1229,12 +1235,14 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
1229 sb->s_flags &= ~MS_RDONLY; 1235 sb->s_flags &= ~MS_RDONLY;
1230 } 1236 }
1231 ext2_sync_super(sb, es); 1237 ext2_sync_super(sb, es);
1238 unlock_kernel();
1232 return 0; 1239 return 0;
1233restore_opts: 1240restore_opts:
1234 sbi->s_mount_opt = old_opts.s_mount_opt; 1241 sbi->s_mount_opt = old_opts.s_mount_opt;
1235 sbi->s_resuid = old_opts.s_resuid; 1242 sbi->s_resuid = old_opts.s_resuid;
1236 sbi->s_resgid = old_opts.s_resgid; 1243 sbi->s_resgid = old_opts.s_resgid;
1237 sb->s_flags = old_sb_flags; 1244 sb->s_flags = old_sb_flags;
1245 unlock_kernel();
1238 return err; 1246 return err;
1239} 1247}
1240 1248
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index e213a2613a56..26aa64dee6aa 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -2490,6 +2490,8 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2490 int i; 2490 int i;
2491#endif 2491#endif
2492 2492
2493 lock_kernel();
2494
2493 /* Store the original options */ 2495 /* Store the original options */
2494 lock_super(sb); 2496 lock_super(sb);
2495 old_sb_flags = sb->s_flags; 2497 old_sb_flags = sb->s_flags;
@@ -2600,6 +2602,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2600 kfree(old_opts.s_qf_names[i]); 2602 kfree(old_opts.s_qf_names[i]);
2601#endif 2603#endif
2602 unlock_super(sb); 2604 unlock_super(sb);
2605 unlock_kernel();
2603 return 0; 2606 return 0;
2604restore_opts: 2607restore_opts:
2605 sb->s_flags = old_sb_flags; 2608 sb->s_flags = old_sb_flags;
@@ -2617,6 +2620,7 @@ restore_opts:
2617 } 2620 }
2618#endif 2621#endif
2619 unlock_super(sb); 2622 unlock_super(sb);
2623 unlock_kernel();
2620 return err; 2624 return err;
2621} 2625}
2622 2626
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index c17200a42301..012c4251397e 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3422,6 +3422,8 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
3422 int i; 3422 int i;
3423#endif 3423#endif
3424 3424
3425 lock_kernel();
3426
3425 /* Store the original options */ 3427 /* Store the original options */
3426 lock_super(sb); 3428 lock_super(sb);
3427 old_sb_flags = sb->s_flags; 3429 old_sb_flags = sb->s_flags;
@@ -3558,6 +3560,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
3558 kfree(old_opts.s_qf_names[i]); 3560 kfree(old_opts.s_qf_names[i]);
3559#endif 3561#endif
3560 unlock_super(sb); 3562 unlock_super(sb);
3563 unlock_kernel();
3561 return 0; 3564 return 0;
3562 3565
3563restore_opts: 3566restore_opts:
@@ -3578,6 +3581,7 @@ restore_opts:
3578 } 3581 }
3579#endif 3582#endif
3580 unlock_super(sb); 3583 unlock_super(sb);
3584 unlock_kernel();
3581 return err; 3585 return err;
3582} 3586}
3583 3587
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index f68193cf0811..f2feaa06bf26 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -13,6 +13,7 @@
13#include <linux/statfs.h> 13#include <linux/statfs.h>
14#include <linux/magic.h> 14#include <linux/magic.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/smp_lock.h>
16 17
17/* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */ 18/* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */
18 19
@@ -398,6 +399,7 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
398 399
399 *flags |= MS_NOATIME; 400 *flags |= MS_NOATIME;
400 401
402 lock_kernel();
401 lock_super(s); 403 lock_super(s);
402 uid = sbi->sb_uid; gid = sbi->sb_gid; 404 uid = sbi->sb_uid; gid = sbi->sb_gid;
403 umask = 0777 & ~sbi->sb_mode; 405 umask = 0777 & ~sbi->sb_mode;
@@ -432,10 +434,12 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
432 replace_mount_options(s, new_opts); 434 replace_mount_options(s, new_opts);
433 435
434 unlock_super(s); 436 unlock_super(s);
437 unlock_kernel();
435 return 0; 438 return 0;
436 439
437out_err: 440out_err:
438 unlock_super(s); 441 unlock_super(s);
442 unlock_kernel();
439 kfree(new_opts); 443 kfree(new_opts);
440 return -EINVAL; 444 return -EINVAL;
441} 445}
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 237b27a3d570..3451a81b2142 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -20,6 +20,7 @@
20#include <linux/vmalloc.h> 20#include <linux/vmalloc.h>
21#include <linux/vfs.h> 21#include <linux/vfs.h>
22#include <linux/crc32.h> 22#include <linux/crc32.h>
23#include <linux/smp_lock.h>
23#include "nodelist.h" 24#include "nodelist.h"
24 25
25static int jffs2_flash_setup(struct jffs2_sb_info *c); 26static int jffs2_flash_setup(struct jffs2_sb_info *c);
@@ -387,6 +388,7 @@ int jffs2_remount_fs (struct super_block *sb, int *flags, char *data)
387 This also catches the case where it was stopped and this 388 This also catches the case where it was stopped and this
388 is just a remount to restart it. 389 is just a remount to restart it.
389 Flush the writebuffer, if neccecary, else we loose it */ 390 Flush the writebuffer, if neccecary, else we loose it */
391 lock_kernel();
390 if (!(sb->s_flags & MS_RDONLY)) { 392 if (!(sb->s_flags & MS_RDONLY)) {
391 jffs2_stop_garbage_collect_thread(c); 393 jffs2_stop_garbage_collect_thread(c);
392 mutex_lock(&c->alloc_sem); 394 mutex_lock(&c->alloc_sem);
@@ -399,6 +401,7 @@ int jffs2_remount_fs (struct super_block *sb, int *flags, char *data)
399 401
400 *flags |= MS_NOATIME; 402 *flags |= MS_NOATIME;
401 403
404 unlock_kernel();
402 return 0; 405 return 0;
403} 406}
404 407
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 3eb13adf3862..09b1b6ee2186 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -32,6 +32,7 @@
32#include <linux/crc32.h> 32#include <linux/crc32.h>
33#include <asm/uaccess.h> 33#include <asm/uaccess.h>
34#include <linux/seq_file.h> 34#include <linux/seq_file.h>
35#include <linux/smp_lock.h>
35 36
36#include "jfs_incore.h" 37#include "jfs_incore.h"
37#include "jfs_filsys.h" 38#include "jfs_filsys.h"
@@ -375,19 +376,24 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data)
375 s64 newLVSize = 0; 376 s64 newLVSize = 0;
376 int rc = 0; 377 int rc = 0;
377 int flag = JFS_SBI(sb)->flag; 378 int flag = JFS_SBI(sb)->flag;
379 int ret;
378 380
379 if (!parse_options(data, sb, &newLVSize, &flag)) { 381 if (!parse_options(data, sb, &newLVSize, &flag)) {
380 return -EINVAL; 382 return -EINVAL;
381 } 383 }
384 lock_kernel();
382 if (newLVSize) { 385 if (newLVSize) {
383 if (sb->s_flags & MS_RDONLY) { 386 if (sb->s_flags & MS_RDONLY) {
384 printk(KERN_ERR 387 printk(KERN_ERR
385 "JFS: resize requires volume to be mounted read-write\n"); 388 "JFS: resize requires volume to be mounted read-write\n");
389 unlock_kernel();
386 return -EROFS; 390 return -EROFS;
387 } 391 }
388 rc = jfs_extendfs(sb, newLVSize, 0); 392 rc = jfs_extendfs(sb, newLVSize, 0);
389 if (rc) 393 if (rc) {
394 unlock_kernel();
390 return rc; 395 return rc;
396 }
391 } 397 }
392 398
393 if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { 399 if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
@@ -398,23 +404,31 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data)
398 truncate_inode_pages(JFS_SBI(sb)->direct_inode->i_mapping, 0); 404 truncate_inode_pages(JFS_SBI(sb)->direct_inode->i_mapping, 0);
399 405
400 JFS_SBI(sb)->flag = flag; 406 JFS_SBI(sb)->flag = flag;
401 return jfs_mount_rw(sb, 1); 407 ret = jfs_mount_rw(sb, 1);
408 unlock_kernel();
409 return ret;
402 } 410 }
403 if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) { 411 if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) {
404 rc = jfs_umount_rw(sb); 412 rc = jfs_umount_rw(sb);
405 JFS_SBI(sb)->flag = flag; 413 JFS_SBI(sb)->flag = flag;
414 unlock_kernel();
406 return rc; 415 return rc;
407 } 416 }
408 if ((JFS_SBI(sb)->flag & JFS_NOINTEGRITY) != (flag & JFS_NOINTEGRITY)) 417 if ((JFS_SBI(sb)->flag & JFS_NOINTEGRITY) != (flag & JFS_NOINTEGRITY))
409 if (!(sb->s_flags & MS_RDONLY)) { 418 if (!(sb->s_flags & MS_RDONLY)) {
410 rc = jfs_umount_rw(sb); 419 rc = jfs_umount_rw(sb);
411 if (rc) 420 if (rc) {
421 unlock_kernel();
412 return rc; 422 return rc;
423 }
413 JFS_SBI(sb)->flag = flag; 424 JFS_SBI(sb)->flag = flag;
414 return jfs_mount_rw(sb, 1); 425 ret = jfs_mount_rw(sb, 1);
426 unlock_kernel();
427 return ret;
415 } 428 }
416 JFS_SBI(sb)->flag = flag; 429 JFS_SBI(sb)->flag = flag;
417 430
431 unlock_kernel();
418 return 0; 432 return 0;
419} 433}
420 434
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index d2d67781c579..26127b69a275 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1813,6 +1813,7 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data)
1813 if (data == NULL) 1813 if (data == NULL)
1814 return -ENOMEM; 1814 return -ENOMEM;
1815 1815
1816 lock_kernel();
1816 /* fill out struct with values from existing mount */ 1817 /* fill out struct with values from existing mount */
1817 data->flags = nfss->flags; 1818 data->flags = nfss->flags;
1818 data->rsize = nfss->rsize; 1819 data->rsize = nfss->rsize;
@@ -1837,6 +1838,7 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data)
1837 error = nfs_compare_remount_data(nfss, data); 1838 error = nfs_compare_remount_data(nfss, data);
1838out: 1839out:
1839 kfree(data); 1840 kfree(data);
1841 unlock_kernel();
1840 return error; 1842 return error;
1841} 1843}
1842 1844
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 7262e8427c20..11151eaa2c4a 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -906,6 +906,8 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data)
906 struct nilfs_mount_options old_opts; 906 struct nilfs_mount_options old_opts;
907 int err; 907 int err;
908 908
909 lock_kernel();
910
909 old_sb_flags = sb->s_flags; 911 old_sb_flags = sb->s_flags;
910 old_opts.mount_opt = sbi->s_mount_opt; 912 old_opts.mount_opt = sbi->s_mount_opt;
911 old_opts.snapshot_cno = sbi->s_snapshot_cno; 913 old_opts.snapshot_cno = sbi->s_snapshot_cno;
@@ -985,6 +987,7 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data)
985 up(&sb->s_bdev->bd_mount_sem); 987 up(&sb->s_bdev->bd_mount_sem);
986 } 988 }
987 out: 989 out:
990 unlock_kernel();
988 return 0; 991 return 0;
989 992
990 rw_remount_failed: 993 rw_remount_failed:
@@ -993,6 +996,7 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data)
993 sb->s_flags = old_sb_flags; 996 sb->s_flags = old_sb_flags;
994 sbi->s_mount_opt = old_opts.mount_opt; 997 sbi->s_mount_opt = old_opts.mount_opt;
995 sbi->s_snapshot_cno = old_opts.snapshot_cno; 998 sbi->s_snapshot_cno = old_opts.snapshot_cno;
999 unlock_kernel();
996 return err; 1000 return err;
997} 1001}
998 1002
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 7a7b0d326395..abaaa1cbf8de 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -443,6 +443,8 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
443 ntfs_volume *vol = NTFS_SB(sb); 443 ntfs_volume *vol = NTFS_SB(sb);
444 444
445 ntfs_debug("Entering with remount options string: %s", opt); 445 ntfs_debug("Entering with remount options string: %s", opt);
446
447 lock_kernel();
446#ifndef NTFS_RW 448#ifndef NTFS_RW
447 /* For read-only compiled driver, enforce read-only flag. */ 449 /* For read-only compiled driver, enforce read-only flag. */
448 *flags |= MS_RDONLY; 450 *flags |= MS_RDONLY;
@@ -466,15 +468,18 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
466 if (NVolErrors(vol)) { 468 if (NVolErrors(vol)) {
467 ntfs_error(sb, "Volume has errors and is read-only%s", 469 ntfs_error(sb, "Volume has errors and is read-only%s",
468 es); 470 es);
471 unlock_kernel();
469 return -EROFS; 472 return -EROFS;
470 } 473 }
471 if (vol->vol_flags & VOLUME_IS_DIRTY) { 474 if (vol->vol_flags & VOLUME_IS_DIRTY) {
472 ntfs_error(sb, "Volume is dirty and read-only%s", es); 475 ntfs_error(sb, "Volume is dirty and read-only%s", es);
476 unlock_kernel();
473 return -EROFS; 477 return -EROFS;
474 } 478 }
475 if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) { 479 if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) {
476 ntfs_error(sb, "Volume has been modified by chkdsk " 480 ntfs_error(sb, "Volume has been modified by chkdsk "
477 "and is read-only%s", es); 481 "and is read-only%s", es);
482 unlock_kernel();
478 return -EROFS; 483 return -EROFS;
479 } 484 }
480 if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { 485 if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) {
@@ -482,11 +487,13 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
482 "(0x%x) and is read-only%s", 487 "(0x%x) and is read-only%s",
483 (unsigned)le16_to_cpu(vol->vol_flags), 488 (unsigned)le16_to_cpu(vol->vol_flags),
484 es); 489 es);
490 unlock_kernel();
485 return -EROFS; 491 return -EROFS;
486 } 492 }
487 if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { 493 if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) {
488 ntfs_error(sb, "Failed to set dirty bit in volume " 494 ntfs_error(sb, "Failed to set dirty bit in volume "
489 "information flags%s", es); 495 "information flags%s", es);
496 unlock_kernel();
490 return -EROFS; 497 return -EROFS;
491 } 498 }
492#if 0 499#if 0
@@ -506,18 +513,21 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
506 ntfs_error(sb, "Failed to empty journal $LogFile%s", 513 ntfs_error(sb, "Failed to empty journal $LogFile%s",
507 es); 514 es);
508 NVolSetErrors(vol); 515 NVolSetErrors(vol);
516 unlock_kernel();
509 return -EROFS; 517 return -EROFS;
510 } 518 }
511 if (!ntfs_mark_quotas_out_of_date(vol)) { 519 if (!ntfs_mark_quotas_out_of_date(vol)) {
512 ntfs_error(sb, "Failed to mark quotas out of date%s", 520 ntfs_error(sb, "Failed to mark quotas out of date%s",
513 es); 521 es);
514 NVolSetErrors(vol); 522 NVolSetErrors(vol);
523 unlock_kernel();
515 return -EROFS; 524 return -EROFS;
516 } 525 }
517 if (!ntfs_stamp_usnjrnl(vol)) { 526 if (!ntfs_stamp_usnjrnl(vol)) {
518 ntfs_error(sb, "Failed to stamp transation log " 527 ntfs_error(sb, "Failed to stamp transation log "
519 "($UsnJrnl)%s", es); 528 "($UsnJrnl)%s", es);
520 NVolSetErrors(vol); 529 NVolSetErrors(vol);
530 unlock_kernel();
521 return -EROFS; 531 return -EROFS;
522 } 532 }
523 } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) { 533 } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) {
@@ -533,8 +543,11 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
533 543
534 // TODO: Deal with *flags. 544 // TODO: Deal with *flags.
535 545
536 if (!parse_options(vol, opt)) 546 if (!parse_options(vol, opt)) {
547 unlock_kernel();
537 return -EINVAL; 548 return -EINVAL;
549 }
550 unlock_kernel();
538 ntfs_debug("Done."); 551 ntfs_debug("Done.");
539 return 0; 552 return 0;
540} 553}
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 02737596b597..201b40a441fe 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -42,6 +42,7 @@
42#include <linux/mount.h> 42#include <linux/mount.h>
43#include <linux/seq_file.h> 43#include <linux/seq_file.h>
44#include <linux/quotaops.h> 44#include <linux/quotaops.h>
45#include <linux/smp_lock.h>
45 46
46#define MLOG_MASK_PREFIX ML_SUPER 47#define MLOG_MASK_PREFIX ML_SUPER
47#include <cluster/masklog.h> 48#include <cluster/masklog.h>
@@ -581,6 +582,8 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data)
581 struct mount_options parsed_options; 582 struct mount_options parsed_options;
582 struct ocfs2_super *osb = OCFS2_SB(sb); 583 struct ocfs2_super *osb = OCFS2_SB(sb);
583 584
585 lock_kernel();
586
584 if (!ocfs2_parse_options(sb, data, &parsed_options, 1)) { 587 if (!ocfs2_parse_options(sb, data, &parsed_options, 1)) {
585 ret = -EINVAL; 588 ret = -EINVAL;
586 goto out; 589 goto out;
@@ -684,6 +687,7 @@ unlock_osb:
684 ocfs2_set_journal_params(osb); 687 ocfs2_set_journal_params(osb);
685 } 688 }
686out: 689out:
690 unlock_kernel();
687 return ret; 691 return ret;
688} 692}
689 693
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 90dcb7b033ea..2969773cfc22 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -28,6 +28,7 @@
28#include <linux/mount.h> 28#include <linux/mount.h>
29#include <linux/namei.h> 29#include <linux/namei.h>
30#include <linux/crc32.h> 30#include <linux/crc32.h>
31#include <linux/smp_lock.h>
31 32
32struct file_system_type reiserfs_fs_type; 33struct file_system_type reiserfs_fs_type;
33 34
@@ -1196,6 +1197,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
1196 memcpy(qf_names, REISERFS_SB(s)->s_qf_names, sizeof(qf_names)); 1197 memcpy(qf_names, REISERFS_SB(s)->s_qf_names, sizeof(qf_names));
1197#endif 1198#endif
1198 1199
1200 lock_kernel();
1199 rs = SB_DISK_SUPER_BLOCK(s); 1201 rs = SB_DISK_SUPER_BLOCK(s);
1200 1202
1201 if (!reiserfs_parse_options 1203 if (!reiserfs_parse_options
@@ -1318,10 +1320,12 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
1318 1320
1319out_ok: 1321out_ok:
1320 replace_mount_options(s, new_opts); 1322 replace_mount_options(s, new_opts);
1323 unlock_kernel();
1321 return 0; 1324 return 0;
1322 1325
1323out_err: 1326out_err:
1324 kfree(new_opts); 1327 kfree(new_opts);
1328 unlock_kernel();
1325 return err; 1329 return err;
1326} 1330}
1327 1331
diff --git a/fs/super.c b/fs/super.c
index 1905f4af01cc..83b47416d006 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -540,7 +540,6 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
540 shrink_dcache_sb(sb); 540 shrink_dcache_sb(sb);
541 sync_filesystem(sb); 541 sync_filesystem(sb);
542 542
543 lock_kernel();
544 /* If we are remounting RDONLY and current sb is read/write, 543 /* If we are remounting RDONLY and current sb is read/write,
545 make sure there are no rw files opened */ 544 make sure there are no rw files opened */
546 if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) { 545 if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) {
@@ -566,7 +565,6 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
566 } 565 }
567 } 566 }
568 sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK); 567 sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK);
569 unlock_kernel();
570 if (remount_rw) 568 if (remount_rw)
571 vfs_dq_quota_on_remount(sb); 569 vfs_dq_quota_on_remount(sb);
572 return 0; 570 return 0;
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 522c3fd7eb3c..3589eab02a2f 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -36,6 +36,7 @@
36#include <linux/mount.h> 36#include <linux/mount.h>
37#include <linux/math64.h> 37#include <linux/math64.h>
38#include <linux/writeback.h> 38#include <linux/writeback.h>
39#include <linux/smp_lock.h>
39#include "ubifs.h" 40#include "ubifs.h"
40 41
41/* 42/*
@@ -1770,17 +1771,22 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
1770 return err; 1771 return err;
1771 } 1772 }
1772 1773
1774 lock_kernel();
1773 if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { 1775 if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
1774 if (c->ro_media) { 1776 if (c->ro_media) {
1775 ubifs_msg("cannot re-mount due to prior errors"); 1777 ubifs_msg("cannot re-mount due to prior errors");
1778 unlock_kernel();
1776 return -EROFS; 1779 return -EROFS;
1777 } 1780 }
1778 err = ubifs_remount_rw(c); 1781 err = ubifs_remount_rw(c);
1779 if (err) 1782 if (err) {
1783 unlock_kernel();
1780 return err; 1784 return err;
1785 }
1781 } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) { 1786 } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) {
1782 if (c->ro_media) { 1787 if (c->ro_media) {
1783 ubifs_msg("cannot re-mount due to prior errors"); 1788 ubifs_msg("cannot re-mount due to prior errors");
1789 unlock_kernel();
1784 return -EROFS; 1790 return -EROFS;
1785 } 1791 }
1786 ubifs_remount_ro(c); 1792 ubifs_remount_ro(c);
@@ -1795,6 +1801,7 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
1795 } 1801 }
1796 1802
1797 ubifs_assert(c->lst.taken_empty_lebs > 0); 1803 ubifs_assert(c->lst.taken_empty_lebs > 0);
1804 unlock_kernel();
1798 return 0; 1805 return 0;
1799} 1806}
1800 1807
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 04802cc39b18..6832135159b6 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -568,6 +568,7 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options)
568 if (!udf_parse_options(options, &uopt, true)) 568 if (!udf_parse_options(options, &uopt, true))
569 return -EINVAL; 569 return -EINVAL;
570 570
571 lock_kernel();
571 sbi->s_flags = uopt.flags; 572 sbi->s_flags = uopt.flags;
572 sbi->s_uid = uopt.uid; 573 sbi->s_uid = uopt.uid;
573 sbi->s_gid = uopt.gid; 574 sbi->s_gid = uopt.gid;
@@ -581,13 +582,16 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options)
581 *flags |= MS_RDONLY; 582 *flags |= MS_RDONLY;
582 } 583 }
583 584
584 if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) 585 if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
586 unlock_kernel();
585 return 0; 587 return 0;
588 }
586 if (*flags & MS_RDONLY) 589 if (*flags & MS_RDONLY)
587 udf_close_lvid(sb); 590 udf_close_lvid(sb);
588 else 591 else
589 udf_open_lvid(sb); 592 udf_open_lvid(sb);
590 593
594 unlock_kernel();
591 return 0; 595 return 0;
592} 596}
593 597
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index c97210ee0670..6560dda7b18c 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -263,6 +263,7 @@ void ufs_panic (struct super_block * sb, const char * function,
263 struct ufs_super_block_first * usb1; 263 struct ufs_super_block_first * usb1;
264 va_list args; 264 va_list args;
265 265
266 lock_kernel();
266 uspi = UFS_SB(sb)->s_uspi; 267 uspi = UFS_SB(sb)->s_uspi;
267 usb1 = ubh_get_usb_first(uspi); 268 usb1 = ubh_get_usb_first(uspi);
268 269
@@ -1182,7 +1183,8 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
1182 struct ufs_super_block_third * usb3; 1183 struct ufs_super_block_third * usb3;
1183 unsigned new_mount_opt, ufstype; 1184 unsigned new_mount_opt, ufstype;
1184 unsigned flags; 1185 unsigned flags;
1185 1186
1187 lock_kernel();
1186 lock_super(sb); 1188 lock_super(sb);
1187 uspi = UFS_SB(sb)->s_uspi; 1189 uspi = UFS_SB(sb)->s_uspi;
1188 flags = UFS_SB(sb)->s_flags; 1190 flags = UFS_SB(sb)->s_flags;
@@ -1198,6 +1200,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
1198 ufs_set_opt (new_mount_opt, ONERROR_LOCK); 1200 ufs_set_opt (new_mount_opt, ONERROR_LOCK);
1199 if (!ufs_parse_options (data, &new_mount_opt)) { 1201 if (!ufs_parse_options (data, &new_mount_opt)) {
1200 unlock_super(sb); 1202 unlock_super(sb);
1203 unlock_kernel();
1201 return -EINVAL; 1204 return -EINVAL;
1202 } 1205 }
1203 if (!(new_mount_opt & UFS_MOUNT_UFSTYPE)) { 1206 if (!(new_mount_opt & UFS_MOUNT_UFSTYPE)) {
@@ -1205,12 +1208,14 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
1205 } else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) { 1208 } else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) {
1206 printk("ufstype can't be changed during remount\n"); 1209 printk("ufstype can't be changed during remount\n");
1207 unlock_super(sb); 1210 unlock_super(sb);
1211 unlock_kernel();
1208 return -EINVAL; 1212 return -EINVAL;
1209 } 1213 }
1210 1214
1211 if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { 1215 if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
1212 UFS_SB(sb)->s_mount_opt = new_mount_opt; 1216 UFS_SB(sb)->s_mount_opt = new_mount_opt;
1213 unlock_super(sb); 1217 unlock_super(sb);
1218 unlock_kernel();
1214 return 0; 1219 return 0;
1215 } 1220 }
1216 1221
@@ -1236,6 +1241,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
1236 printk("ufs was compiled with read-only support, " 1241 printk("ufs was compiled with read-only support, "
1237 "can't be mounted as read-write\n"); 1242 "can't be mounted as read-write\n");
1238 unlock_super(sb); 1243 unlock_super(sb);
1244 unlock_kernel();
1239 return -EINVAL; 1245 return -EINVAL;
1240#else 1246#else
1241 if (ufstype != UFS_MOUNT_UFSTYPE_SUN && 1247 if (ufstype != UFS_MOUNT_UFSTYPE_SUN &&
@@ -1245,11 +1251,13 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
1245 ufstype != UFS_MOUNT_UFSTYPE_UFS2) { 1251 ufstype != UFS_MOUNT_UFSTYPE_UFS2) {
1246 printk("this ufstype is read-only supported\n"); 1252 printk("this ufstype is read-only supported\n");
1247 unlock_super(sb); 1253 unlock_super(sb);
1254 unlock_kernel();
1248 return -EINVAL; 1255 return -EINVAL;
1249 } 1256 }
1250 if (!ufs_read_cylinder_structures(sb)) { 1257 if (!ufs_read_cylinder_structures(sb)) {
1251 printk("failed during remounting\n"); 1258 printk("failed during remounting\n");
1252 unlock_super(sb); 1259 unlock_super(sb);
1260 unlock_kernel();
1253 return -EPERM; 1261 return -EPERM;
1254 } 1262 }
1255 sb->s_flags &= ~MS_RDONLY; 1263 sb->s_flags &= ~MS_RDONLY;
@@ -1257,6 +1265,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
1257 } 1265 }
1258 UFS_SB(sb)->s_mount_opt = new_mount_opt; 1266 UFS_SB(sb)->s_mount_opt = new_mount_opt;
1259 unlock_super(sb); 1267 unlock_super(sb);
1268 unlock_kernel();
1260 return 0; 1269 return 0;
1261} 1270}
1262 1271
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index a7267bfd3765..3fb789f6df94 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -46,6 +46,7 @@
46#include <linux/cgroupstats.h> 46#include <linux/cgroupstats.h>
47#include <linux/hash.h> 47#include <linux/hash.h>
48#include <linux/namei.h> 48#include <linux/namei.h>
49#include <linux/smp_lock.h>
49 50
50#include <asm/atomic.h> 51#include <asm/atomic.h>
51 52
@@ -900,6 +901,7 @@ static int cgroup_remount(struct super_block *sb, int *flags, char *data)
900 struct cgroup *cgrp = &root->top_cgroup; 901 struct cgroup *cgrp = &root->top_cgroup;
901 struct cgroup_sb_opts opts; 902 struct cgroup_sb_opts opts;
902 903
904 lock_kernel();
903 mutex_lock(&cgrp->dentry->d_inode->i_mutex); 905 mutex_lock(&cgrp->dentry->d_inode->i_mutex);
904 mutex_lock(&cgroup_mutex); 906 mutex_lock(&cgroup_mutex);
905 907
@@ -927,6 +929,7 @@ static int cgroup_remount(struct super_block *sb, int *flags, char *data)
927 kfree(opts.release_agent); 929 kfree(opts.release_agent);
928 mutex_unlock(&cgroup_mutex); 930 mutex_unlock(&cgroup_mutex);
929 mutex_unlock(&cgrp->dentry->d_inode->i_mutex); 931 mutex_unlock(&cgrp->dentry->d_inode->i_mutex);
932 unlock_kernel();
930 return ret; 933 return ret;
931} 934}
932 935