diff options
| author | Jan Blunck <jblunck@infradead.org> | 2010-02-24 07:25:33 -0500 |
|---|---|---|
| committer | Arnd Bergmann <arnd@arndb.de> | 2010-10-04 15:10:41 -0400 |
| commit | efdffb54034a6fc96bc7fafa33ca2a5503113eee (patch) | |
| tree | 6e69acdf0d626e04a182b568fdc5f084f06d9d5f /fs/ntfs | |
| parent | d6d4c19c5f9ac5972e30e89b3c81ad1fd6e11fee (diff) | |
BKL: Remove BKL from NTFS
The BKL is only used in put_super, fill_super and remount_fs that are all
three protected by the superblocks s_umount rw_semaphore. Therefore it is
safe to remove the BKL entirely.
Signed-off-by: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'fs/ntfs')
| -rw-r--r-- | fs/ntfs/super.c | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 1f31e77fc41f..19c5180f8a28 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
| @@ -30,7 +30,6 @@ | |||
| 30 | #include <linux/buffer_head.h> | 30 | #include <linux/buffer_head.h> |
| 31 | #include <linux/vfs.h> | 31 | #include <linux/vfs.h> |
| 32 | #include <linux/moduleparam.h> | 32 | #include <linux/moduleparam.h> |
| 33 | #include <linux/smp_lock.h> | ||
| 34 | #include <linux/bitmap.h> | 33 | #include <linux/bitmap.h> |
| 35 | 34 | ||
| 36 | #include "sysctl.h" | 35 | #include "sysctl.h" |
| @@ -445,7 +444,6 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
| 445 | 444 | ||
| 446 | ntfs_debug("Entering with remount options string: %s", opt); | 445 | ntfs_debug("Entering with remount options string: %s", opt); |
| 447 | 446 | ||
| 448 | lock_kernel(); | ||
| 449 | #ifndef NTFS_RW | 447 | #ifndef NTFS_RW |
| 450 | /* For read-only compiled driver, enforce read-only flag. */ | 448 | /* For read-only compiled driver, enforce read-only flag. */ |
| 451 | *flags |= MS_RDONLY; | 449 | *flags |= MS_RDONLY; |
| @@ -469,18 +467,15 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
| 469 | if (NVolErrors(vol)) { | 467 | if (NVolErrors(vol)) { |
| 470 | ntfs_error(sb, "Volume has errors and is read-only%s", | 468 | ntfs_error(sb, "Volume has errors and is read-only%s", |
| 471 | es); | 469 | es); |
| 472 | unlock_kernel(); | ||
| 473 | return -EROFS; | 470 | return -EROFS; |
| 474 | } | 471 | } |
| 475 | if (vol->vol_flags & VOLUME_IS_DIRTY) { | 472 | if (vol->vol_flags & VOLUME_IS_DIRTY) { |
| 476 | ntfs_error(sb, "Volume is dirty and read-only%s", es); | 473 | ntfs_error(sb, "Volume is dirty and read-only%s", es); |
| 477 | unlock_kernel(); | ||
| 478 | return -EROFS; | 474 | return -EROFS; |
| 479 | } | 475 | } |
| 480 | if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) { | 476 | if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) { |
| 481 | ntfs_error(sb, "Volume has been modified by chkdsk " | 477 | ntfs_error(sb, "Volume has been modified by chkdsk " |
| 482 | "and is read-only%s", es); | 478 | "and is read-only%s", es); |
| 483 | unlock_kernel(); | ||
| 484 | return -EROFS; | 479 | return -EROFS; |
| 485 | } | 480 | } |
| 486 | if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { | 481 | if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { |
| @@ -488,13 +483,11 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
| 488 | "(0x%x) and is read-only%s", | 483 | "(0x%x) and is read-only%s", |
| 489 | (unsigned)le16_to_cpu(vol->vol_flags), | 484 | (unsigned)le16_to_cpu(vol->vol_flags), |
| 490 | es); | 485 | es); |
| 491 | unlock_kernel(); | ||
| 492 | return -EROFS; | 486 | return -EROFS; |
| 493 | } | 487 | } |
| 494 | if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { | 488 | if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { |
| 495 | ntfs_error(sb, "Failed to set dirty bit in volume " | 489 | ntfs_error(sb, "Failed to set dirty bit in volume " |
| 496 | "information flags%s", es); | 490 | "information flags%s", es); |
| 497 | unlock_kernel(); | ||
| 498 | return -EROFS; | 491 | return -EROFS; |
| 499 | } | 492 | } |
| 500 | #if 0 | 493 | #if 0 |
| @@ -514,21 +507,18 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
| 514 | ntfs_error(sb, "Failed to empty journal $LogFile%s", | 507 | ntfs_error(sb, "Failed to empty journal $LogFile%s", |
| 515 | es); | 508 | es); |
| 516 | NVolSetErrors(vol); | 509 | NVolSetErrors(vol); |
| 517 | unlock_kernel(); | ||
| 518 | return -EROFS; | 510 | return -EROFS; |
| 519 | } | 511 | } |
| 520 | if (!ntfs_mark_quotas_out_of_date(vol)) { | 512 | if (!ntfs_mark_quotas_out_of_date(vol)) { |
| 521 | ntfs_error(sb, "Failed to mark quotas out of date%s", | 513 | ntfs_error(sb, "Failed to mark quotas out of date%s", |
| 522 | es); | 514 | es); |
| 523 | NVolSetErrors(vol); | 515 | NVolSetErrors(vol); |
| 524 | unlock_kernel(); | ||
| 525 | return -EROFS; | 516 | return -EROFS; |
| 526 | } | 517 | } |
| 527 | if (!ntfs_stamp_usnjrnl(vol)) { | 518 | if (!ntfs_stamp_usnjrnl(vol)) { |
| 528 | ntfs_error(sb, "Failed to stamp transation log " | 519 | ntfs_error(sb, "Failed to stamp transation log " |
| 529 | "($UsnJrnl)%s", es); | 520 | "($UsnJrnl)%s", es); |
| 530 | NVolSetErrors(vol); | 521 | NVolSetErrors(vol); |
| 531 | unlock_kernel(); | ||
| 532 | return -EROFS; | 522 | return -EROFS; |
| 533 | } | 523 | } |
| 534 | } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) { | 524 | } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) { |
| @@ -544,11 +534,9 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
| 544 | 534 | ||
| 545 | // TODO: Deal with *flags. | 535 | // TODO: Deal with *flags. |
| 546 | 536 | ||
| 547 | if (!parse_options(vol, opt)) { | 537 | if (!parse_options(vol, opt)) |
| 548 | unlock_kernel(); | ||
| 549 | return -EINVAL; | 538 | return -EINVAL; |
| 550 | } | 539 | |
| 551 | unlock_kernel(); | ||
| 552 | ntfs_debug("Done."); | 540 | ntfs_debug("Done."); |
| 553 | return 0; | 541 | return 0; |
| 554 | } | 542 | } |
| @@ -2261,8 +2249,6 @@ static void ntfs_put_super(struct super_block *sb) | |||
| 2261 | 2249 | ||
| 2262 | ntfs_debug("Entering."); | 2250 | ntfs_debug("Entering."); |
| 2263 | 2251 | ||
| 2264 | lock_kernel(); | ||
| 2265 | |||
| 2266 | #ifdef NTFS_RW | 2252 | #ifdef NTFS_RW |
| 2267 | /* | 2253 | /* |
| 2268 | * 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 |
| @@ -2433,8 +2419,6 @@ static void ntfs_put_super(struct super_block *sb) | |||
| 2433 | 2419 | ||
| 2434 | sb->s_fs_info = NULL; | 2420 | sb->s_fs_info = NULL; |
| 2435 | kfree(vol); | 2421 | kfree(vol); |
| 2436 | |||
| 2437 | unlock_kernel(); | ||
| 2438 | } | 2422 | } |
| 2439 | 2423 | ||
| 2440 | /** | 2424 | /** |
| @@ -2732,8 +2716,6 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) | |||
| 2732 | struct inode *tmp_ino; | 2716 | struct inode *tmp_ino; |
| 2733 | int blocksize, result; | 2717 | int blocksize, result; |
| 2734 | 2718 | ||
| 2735 | lock_kernel(); | ||
| 2736 | |||
| 2737 | /* | 2719 | /* |
| 2738 | * We do a pretty difficult piece of bootstrap by reading the | 2720 | * We do a pretty difficult piece of bootstrap by reading the |
| 2739 | * MFT (and other metadata) from disk into memory. We'll only | 2721 | * MFT (and other metadata) from disk into memory. We'll only |
| @@ -2757,7 +2739,6 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) | |||
| 2757 | ntfs_error(sb, "Allocation of NTFS volume structure " | 2739 | ntfs_error(sb, "Allocation of NTFS volume structure " |
| 2758 | "failed. Aborting mount..."); | 2740 | "failed. Aborting mount..."); |
| 2759 | lockdep_on(); | 2741 | lockdep_on(); |
| 2760 | unlock_kernel(); | ||
| 2761 | return -ENOMEM; | 2742 | return -ENOMEM; |
| 2762 | } | 2743 | } |
| 2763 | /* Initialize ntfs_volume structure. */ | 2744 | /* Initialize ntfs_volume structure. */ |
| @@ -2775,8 +2756,6 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) | |||
| 2775 | init_rwsem(&vol->mftbmp_lock); | 2756 | init_rwsem(&vol->mftbmp_lock); |
| 2776 | init_rwsem(&vol->lcnbmp_lock); | 2757 | init_rwsem(&vol->lcnbmp_lock); |
| 2777 | 2758 | ||
| 2778 | unlock_kernel(); | ||
| 2779 | |||
| 2780 | /* By default, enable sparse support. */ | 2759 | /* By default, enable sparse support. */ |
| 2781 | NVolSetSparseEnabled(vol); | 2760 | NVolSetSparseEnabled(vol); |
| 2782 | 2761 | ||
| @@ -2943,9 +2922,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) | |||
| 2943 | } | 2922 | } |
| 2944 | mutex_unlock(&ntfs_lock); | 2923 | mutex_unlock(&ntfs_lock); |
| 2945 | sb->s_export_op = &ntfs_export_ops; | 2924 | sb->s_export_op = &ntfs_export_ops; |
| 2946 | lock_kernel(); | ||
| 2947 | lockdep_on(); | 2925 | lockdep_on(); |
| 2948 | unlock_kernel(); | ||
| 2949 | return 0; | 2926 | return 0; |
| 2950 | } | 2927 | } |
| 2951 | ntfs_error(sb, "Failed to allocate root directory."); | 2928 | ntfs_error(sb, "Failed to allocate root directory."); |
| @@ -3061,12 +3038,10 @@ iput_tmp_ino_err_out_now: | |||
| 3061 | } | 3038 | } |
| 3062 | /* Errors at this stage are irrelevant. */ | 3039 | /* Errors at this stage are irrelevant. */ |
| 3063 | err_out_now: | 3040 | err_out_now: |
| 3064 | lock_kernel(); | ||
| 3065 | sb->s_fs_info = NULL; | 3041 | sb->s_fs_info = NULL; |
| 3066 | kfree(vol); | 3042 | kfree(vol); |
| 3067 | ntfs_debug("Failed, returning -EINVAL."); | 3043 | ntfs_debug("Failed, returning -EINVAL."); |
| 3068 | lockdep_on(); | 3044 | lockdep_on(); |
| 3069 | unlock_kernel(); | ||
| 3070 | return -EINVAL; | 3045 | return -EINVAL; |
| 3071 | } | 3046 | } |
| 3072 | 3047 | ||
