Commit efdffb54 authored by Jan Blunck's avatar Jan Blunck Committed by Arnd Bergmann

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: default avatarJan Blunck <jblunck@infradead.org>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent d6d4c19c
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/vfs.h> #include <linux/vfs.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/smp_lock.h>
#include <linux/bitmap.h> #include <linux/bitmap.h>
#include "sysctl.h" #include "sysctl.h"
...@@ -445,7 +444,6 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) ...@@ -445,7 +444,6 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
ntfs_debug("Entering with remount options string: %s", opt); ntfs_debug("Entering with remount options string: %s", opt);
lock_kernel();
#ifndef NTFS_RW #ifndef NTFS_RW
/* For read-only compiled driver, enforce read-only flag. */ /* For read-only compiled driver, enforce read-only flag. */
*flags |= MS_RDONLY; *flags |= MS_RDONLY;
...@@ -469,18 +467,15 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) ...@@ -469,18 +467,15 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
if (NVolErrors(vol)) { if (NVolErrors(vol)) {
ntfs_error(sb, "Volume has errors and is read-only%s", ntfs_error(sb, "Volume has errors and is read-only%s",
es); es);
unlock_kernel();
return -EROFS; return -EROFS;
} }
if (vol->vol_flags & VOLUME_IS_DIRTY) { if (vol->vol_flags & VOLUME_IS_DIRTY) {
ntfs_error(sb, "Volume is dirty and read-only%s", es); ntfs_error(sb, "Volume is dirty and read-only%s", es);
unlock_kernel();
return -EROFS; return -EROFS;
} }
if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) { if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) {
ntfs_error(sb, "Volume has been modified by chkdsk " ntfs_error(sb, "Volume has been modified by chkdsk "
"and is read-only%s", es); "and is read-only%s", es);
unlock_kernel();
return -EROFS; return -EROFS;
} }
if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { 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,13 +483,11 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
"(0x%x) and is read-only%s", "(0x%x) and is read-only%s",
(unsigned)le16_to_cpu(vol->vol_flags), (unsigned)le16_to_cpu(vol->vol_flags),
es); es);
unlock_kernel();
return -EROFS; return -EROFS;
} }
if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) {
ntfs_error(sb, "Failed to set dirty bit in volume " ntfs_error(sb, "Failed to set dirty bit in volume "
"information flags%s", es); "information flags%s", es);
unlock_kernel();
return -EROFS; return -EROFS;
} }
#if 0 #if 0
...@@ -514,21 +507,18 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) ...@@ -514,21 +507,18 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
ntfs_error(sb, "Failed to empty journal $LogFile%s", ntfs_error(sb, "Failed to empty journal $LogFile%s",
es); es);
NVolSetErrors(vol); NVolSetErrors(vol);
unlock_kernel();
return -EROFS; return -EROFS;
} }
if (!ntfs_mark_quotas_out_of_date(vol)) { if (!ntfs_mark_quotas_out_of_date(vol)) {
ntfs_error(sb, "Failed to mark quotas out of date%s", ntfs_error(sb, "Failed to mark quotas out of date%s",
es); es);
NVolSetErrors(vol); NVolSetErrors(vol);
unlock_kernel();
return -EROFS; return -EROFS;
} }
if (!ntfs_stamp_usnjrnl(vol)) { if (!ntfs_stamp_usnjrnl(vol)) {
ntfs_error(sb, "Failed to stamp transation log " ntfs_error(sb, "Failed to stamp transation log "
"($UsnJrnl)%s", es); "($UsnJrnl)%s", es);
NVolSetErrors(vol); NVolSetErrors(vol);
unlock_kernel();
return -EROFS; return -EROFS;
} }
} else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) { } 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,11 +534,9 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
// TODO: Deal with *flags. // TODO: Deal with *flags.
if (!parse_options(vol, opt)) { if (!parse_options(vol, opt))
unlock_kernel();
return -EINVAL; return -EINVAL;
}
unlock_kernel();
ntfs_debug("Done."); ntfs_debug("Done.");
return 0; return 0;
} }
...@@ -2261,8 +2249,6 @@ static void ntfs_put_super(struct super_block *sb) ...@@ -2261,8 +2249,6 @@ static void ntfs_put_super(struct super_block *sb)
ntfs_debug("Entering."); ntfs_debug("Entering.");
lock_kernel();
#ifdef NTFS_RW #ifdef NTFS_RW
/* /*
* Commit all inodes while they are still open in case some of them * 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,8 +2419,6 @@ static void ntfs_put_super(struct super_block *sb)
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
kfree(vol); kfree(vol);
unlock_kernel();
} }
/** /**
...@@ -2732,8 +2716,6 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) ...@@ -2732,8 +2716,6 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
struct inode *tmp_ino; struct inode *tmp_ino;
int blocksize, result; int blocksize, result;
lock_kernel();
/* /*
* We do a pretty difficult piece of bootstrap by reading the * We do a pretty difficult piece of bootstrap by reading the
* MFT (and other metadata) from disk into memory. We'll only * 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,7 +2739,6 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
ntfs_error(sb, "Allocation of NTFS volume structure " ntfs_error(sb, "Allocation of NTFS volume structure "
"failed. Aborting mount..."); "failed. Aborting mount...");
lockdep_on(); lockdep_on();
unlock_kernel();
return -ENOMEM; return -ENOMEM;
} }
/* Initialize ntfs_volume structure. */ /* Initialize ntfs_volume structure. */
...@@ -2775,8 +2756,6 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) ...@@ -2775,8 +2756,6 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
init_rwsem(&vol->mftbmp_lock); init_rwsem(&vol->mftbmp_lock);
init_rwsem(&vol->lcnbmp_lock); init_rwsem(&vol->lcnbmp_lock);
unlock_kernel();
/* By default, enable sparse support. */ /* By default, enable sparse support. */
NVolSetSparseEnabled(vol); NVolSetSparseEnabled(vol);
...@@ -2943,9 +2922,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) ...@@ -2943,9 +2922,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
} }
mutex_unlock(&ntfs_lock); mutex_unlock(&ntfs_lock);
sb->s_export_op = &ntfs_export_ops; sb->s_export_op = &ntfs_export_ops;
lock_kernel();
lockdep_on(); lockdep_on();
unlock_kernel();
return 0; return 0;
} }
ntfs_error(sb, "Failed to allocate root directory."); ntfs_error(sb, "Failed to allocate root directory.");
...@@ -3061,12 +3038,10 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) ...@@ -3061,12 +3038,10 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
} }
/* Errors at this stage are irrelevant. */ /* Errors at this stage are irrelevant. */
err_out_now: err_out_now:
lock_kernel();
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
kfree(vol); kfree(vol);
ntfs_debug("Failed, returning -EINVAL."); ntfs_debug("Failed, returning -EINVAL.");
lockdep_on(); lockdep_on();
unlock_kernel();
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment