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

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: default avatarJan Blunck <jblunck@infradead.org>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Christoph Hellwig <hch@infradead.org>
parent 899611ee
...@@ -352,11 +352,15 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -352,11 +352,15 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
struct adfs_sb_info *asb; struct adfs_sb_info *asb;
struct inode *root; struct inode *root;
lock_kernel();
sb->s_flags |= MS_NODIRATIME; sb->s_flags |= MS_NODIRATIME;
asb = kzalloc(sizeof(*asb), GFP_KERNEL); asb = kzalloc(sizeof(*asb), GFP_KERNEL);
if (!asb) if (!asb) {
unlock_kernel();
return -ENOMEM; return -ENOMEM;
}
sb->s_fs_info = asb; sb->s_fs_info = asb;
/* set default options */ /* set default options */
...@@ -474,6 +478,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -474,6 +478,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
goto error; goto error;
} else } else
sb->s_root->d_op = &adfs_dentry_operations; sb->s_root->d_op = &adfs_dentry_operations;
unlock_kernel();
return 0; return 0;
error_free_bh: error_free_bh:
...@@ -481,6 +486,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -481,6 +486,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
error: error:
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
kfree(asb); kfree(asb);
unlock_kernel();
return -EINVAL; return -EINVAL;
} }
......
...@@ -291,6 +291,8 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -291,6 +291,8 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
u8 sig[4]; u8 sig[4];
int ret = -EINVAL; int ret = -EINVAL;
lock_kernel();
save_mount_options(sb, data); save_mount_options(sb, data);
pr_debug("AFFS: read_super(%s)\n",data ? (const char *)data : "no options"); 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,8 +302,10 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_flags |= MS_NODIRATIME; sb->s_flags |= MS_NODIRATIME;
sbi = kzalloc(sizeof(struct affs_sb_info), GFP_KERNEL); sbi = kzalloc(sizeof(struct affs_sb_info), GFP_KERNEL);
if (!sbi) if (!sbi) {
unlock_kernel();
return -ENOMEM; return -ENOMEM;
}
sb->s_fs_info = sbi; sb->s_fs_info = sbi;
mutex_init(&sbi->s_bmlock); mutex_init(&sbi->s_bmlock);
spin_lock_init(&sbi->symlink_lock); spin_lock_init(&sbi->symlink_lock);
...@@ -312,6 +316,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -312,6 +316,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
printk(KERN_ERR "AFFS: Error parsing options\n"); printk(KERN_ERR "AFFS: Error parsing options\n");
kfree(sbi->s_prefix); kfree(sbi->s_prefix);
kfree(sbi); kfree(sbi);
unlock_kernel();
return -EINVAL; return -EINVAL;
} }
/* N.B. after this point s_prefix must be released */ /* N.B. after this point s_prefix must be released */
...@@ -482,6 +487,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -482,6 +487,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_root->d_op = &affs_dentry_operations; sb->s_root->d_op = &affs_dentry_operations;
pr_debug("AFFS: s_flags=%lX\n",sb->s_flags); pr_debug("AFFS: s_flags=%lX\n",sb->s_flags);
unlock_kernel();
return 0; return 0;
/* /*
...@@ -496,6 +502,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -496,6 +502,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
kfree(sbi->s_prefix); kfree(sbi->s_prefix);
kfree(sbi); kfree(sbi);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
unlock_kernel();
return ret; return ret;
} }
......
...@@ -302,12 +302,15 @@ static int afs_fill_super(struct super_block *sb, void *data) ...@@ -302,12 +302,15 @@ static int afs_fill_super(struct super_block *sb, void *data)
struct inode *inode = NULL; struct inode *inode = NULL;
int ret; int ret;
lock_kernel();
_enter(""); _enter("");
/* allocate a superblock info record */ /* allocate a superblock info record */
as = kzalloc(sizeof(struct afs_super_info), GFP_KERNEL); as = kzalloc(sizeof(struct afs_super_info), GFP_KERNEL);
if (!as) { if (!as) {
_leave(" = -ENOMEM"); _leave(" = -ENOMEM");
unlock_kernel();
return -ENOMEM; return -ENOMEM;
} }
...@@ -341,6 +344,7 @@ static int afs_fill_super(struct super_block *sb, void *data) ...@@ -341,6 +344,7 @@ static int afs_fill_super(struct super_block *sb, void *data)
sb->s_root = root; sb->s_root = root;
_leave(" = 0"); _leave(" = 0");
unlock_kernel();
return 0; return 0;
error_inode: error_inode:
...@@ -354,6 +358,7 @@ static int afs_fill_super(struct super_block *sb, void *data) ...@@ -354,6 +358,7 @@ static int afs_fill_super(struct super_block *sb, void *data)
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
_leave(" = %d", ret); _leave(" = %d", ret);
unlock_kernel();
return ret; return ret;
} }
......
...@@ -322,9 +322,13 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) ...@@ -322,9 +322,13 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
int ret = -EINVAL; int ret = -EINVAL;
unsigned long i_sblock, i_eblock, i_eoff, s_size; unsigned long i_sblock, i_eblock, i_eoff, s_size;
lock_kernel();
info = kzalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) if (!info) {
unlock_kernel();
return -ENOMEM; return -ENOMEM;
}
mutex_init(&info->bfs_lock); mutex_init(&info->bfs_lock);
s->s_fs_info = info; s->s_fs_info = info;
...@@ -439,6 +443,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) ...@@ -439,6 +443,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
brelse(bh); brelse(bh);
brelse(sbh); brelse(sbh);
dump_imap("read_super", s); dump_imap("read_super", s);
unlock_kernel();
return 0; return 0;
out3: out3:
...@@ -452,6 +457,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) ...@@ -452,6 +457,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
mutex_destroy(&info->bfs_lock); mutex_destroy(&info->bfs_lock);
kfree(info); kfree(info);
s->s_fs_info = NULL; s->s_fs_info = NULL;
unlock_kernel();
return ret; return ret;
} }
......
...@@ -514,22 +514,30 @@ cifs_get_sb(struct file_system_type *fs_type, ...@@ -514,22 +514,30 @@ cifs_get_sb(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data, struct vfsmount *mnt) int flags, const char *dev_name, void *data, struct vfsmount *mnt)
{ {
int rc; int rc;
struct super_block *sb = sget(fs_type, NULL, set_anon_super, NULL); struct super_block *sb;
lock_kernel();
sb = sget(fs_type, NULL, set_anon_super, NULL);
cFYI(1, "Devname: %s flags: %d ", dev_name, flags); cFYI(1, "Devname: %s flags: %d ", dev_name, flags);
if (IS_ERR(sb)) if (IS_ERR(sb)) {
unlock_kernel();
return PTR_ERR(sb); return PTR_ERR(sb);
}
sb->s_flags = flags; sb->s_flags = flags;
rc = cifs_read_super(sb, data, dev_name, flags & MS_SILENT ? 1 : 0); rc = cifs_read_super(sb, data, dev_name, flags & MS_SILENT ? 1 : 0);
if (rc) { if (rc) {
deactivate_locked_super(sb); deactivate_locked_super(sb);
unlock_kernel();
return rc; return rc;
} }
sb->s_flags |= MS_ACTIVE; sb->s_flags |= MS_ACTIVE;
simple_set_mnt(mnt, sb); simple_set_mnt(mnt, sb);
unlock_kernel();
return 0; return 0;
} }
......
...@@ -148,6 +148,8 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) ...@@ -148,6 +148,8 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
int error; int error;
int idx; int idx;
lock_kernel();
idx = get_device_index((struct coda_mount_data *) data); idx = get_device_index((struct coda_mount_data *) data);
/* Ignore errors in data, for backward compatibility */ /* 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,11 +161,13 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
vc = &coda_comms[idx]; vc = &coda_comms[idx];
if (!vc->vc_inuse) { if (!vc->vc_inuse) {
printk("coda_read_super: No pseudo device\n"); printk("coda_read_super: No pseudo device\n");
unlock_kernel();
return -EINVAL; return -EINVAL;
} }
if ( vc->vc_sb ) { if ( vc->vc_sb ) {
printk("coda_read_super: Device already mounted\n"); printk("coda_read_super: Device already mounted\n");
unlock_kernel();
return -EBUSY; return -EBUSY;
} }
...@@ -202,6 +206,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) ...@@ -202,6 +206,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
sb->s_root = d_alloc_root(root); sb->s_root = d_alloc_root(root);
if (!sb->s_root) if (!sb->s_root)
goto error; goto error;
unlock_kernel();
return 0; return 0;
error: error:
...@@ -212,6 +217,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) ...@@ -212,6 +217,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
if (vc) if (vc)
vc->vc_sb = NULL; vc->vc_sb = NULL;
unlock_kernel();
return -EINVAL; return -EINVAL;
} }
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/parser.h> #include <linux/parser.h>
#include <linux/fs_stack.h> #include <linux/fs_stack.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/smp_lock.h> /* For lock_kernel() */
#include "ecryptfs_kernel.h" #include "ecryptfs_kernel.h"
/** /**
...@@ -550,6 +551,7 @@ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, ...@@ -550,6 +551,7 @@ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags,
const char *err = "Getting sb failed"; const char *err = "Getting sb failed";
int rc; int rc;
lock_kernel();
sbi = kmem_cache_zalloc(ecryptfs_sb_info_cache, GFP_KERNEL); sbi = kmem_cache_zalloc(ecryptfs_sb_info_cache, GFP_KERNEL);
if (!sbi) { if (!sbi) {
rc = -ENOMEM; rc = -ENOMEM;
...@@ -608,6 +610,7 @@ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, ...@@ -608,6 +610,7 @@ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags,
goto out; goto out;
} }
simple_set_mnt(mnt, s); simple_set_mnt(mnt, s);
unlock_kernel();
return 0; return 0;
out: out:
...@@ -616,6 +619,7 @@ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, ...@@ -616,6 +619,7 @@ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags,
kmem_cache_free(ecryptfs_sb_info_cache, sbi); kmem_cache_free(ecryptfs_sb_info_cache, sbi);
} }
printk(KERN_ERR "%s; rc = [%d]\n", err, rc); printk(KERN_ERR "%s; rc = [%d]\n", err, rc);
unlock_kernel();
return rc; return rc;
} }
......
...@@ -747,15 +747,18 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) ...@@ -747,15 +747,18 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
__le32 features; __le32 features;
int err; int err;
lock_kernel();
err = -ENOMEM;
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi) if (!sbi)
return -ENOMEM; goto failed_unlock;
sbi->s_blockgroup_lock = sbi->s_blockgroup_lock =
kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL); kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);
if (!sbi->s_blockgroup_lock) { if (!sbi->s_blockgroup_lock) {
kfree(sbi); kfree(sbi);
return -ENOMEM; goto failed_unlock;
} }
sb->s_fs_info = sbi; sb->s_fs_info = sbi;
sbi->s_sb_block = sb_block; sbi->s_sb_block = sb_block;
...@@ -1083,6 +1086,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1083,6 +1086,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
if (ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY)) if (ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY))
sb->s_flags |= MS_RDONLY; sb->s_flags |= MS_RDONLY;
ext2_write_super(sb); ext2_write_super(sb);
unlock_kernel();
return 0; return 0;
cantfind_ext2: cantfind_ext2:
...@@ -1107,6 +1111,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1107,6 +1111,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
kfree(sbi->s_blockgroup_lock); kfree(sbi->s_blockgroup_lock);
kfree(sbi); kfree(sbi);
failed_unlock:
unlock_kernel();
return ret; return ret;
} }
......
...@@ -1611,14 +1611,19 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) ...@@ -1611,14 +1611,19 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
__le32 features; __le32 features;
int err; int err;
lock_kernel();
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi) if (!sbi) {
unlock_kernel();
return -ENOMEM; return -ENOMEM;
}
sbi->s_blockgroup_lock = sbi->s_blockgroup_lock =
kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL); kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);
if (!sbi->s_blockgroup_lock) { if (!sbi->s_blockgroup_lock) {
kfree(sbi); kfree(sbi);
unlock_kernel();
return -ENOMEM; return -ENOMEM;
} }
sb->s_fs_info = sbi; sb->s_fs_info = sbi;
...@@ -2026,6 +2031,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) ...@@ -2026,6 +2031,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
"writeback"); "writeback");
lock_kernel(); lock_kernel();
unlock_kernel();
return 0; return 0;
cantfind_ext3: cantfind_ext3:
...@@ -2056,6 +2062,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) ...@@ -2056,6 +2062,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
kfree(sbi->s_blockgroup_lock); kfree(sbi->s_blockgroup_lock);
kfree(sbi); kfree(sbi);
lock_kernel(); lock_kernel();
unlock_kernel();
return ret; return ret;
} }
......
...@@ -2568,6 +2568,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ...@@ -2568,6 +2568,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
int err; int err;
unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO; unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO;
lock_kernel();
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi) if (!sbi)
goto out_free_orig; goto out_free_orig;
...@@ -3166,7 +3168,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ...@@ -3166,7 +3168,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
if (es->s_error_count) if (es->s_error_count)
mod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */ mod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */
lock_kernel();
kfree(orig_data); kfree(orig_data);
return 0; return 0;
...@@ -3213,8 +3214,11 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ...@@ -3213,8 +3214,11 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
kfree(sbi->s_blockgroup_lock); kfree(sbi->s_blockgroup_lock);
kfree(sbi); kfree(sbi);
lock_kernel(); kfree(orig_data);
return ret;
out_free_orig: out_free_orig:
unlock_kernel();
kfree(orig_data); kfree(orig_data);
return ret; return ret;
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/smp_lock.h> /* For lock_kernel() */
#include "fat.h" #include "fat.h"
/* Characters that are undesirable in an MS-DOS file name */ /* 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,12 +663,16 @@ static int msdos_fill_super(struct super_block *sb, void *data, int silent)
{ {
int res; int res;
lock_kernel();
res = fat_fill_super(sb, data, silent, &msdos_dir_inode_operations, 0); res = fat_fill_super(sb, data, silent, &msdos_dir_inode_operations, 0);
if (res) if (res) {
unlock_kernel();
return res; return res;
}
sb->s_flags |= MS_NOATIME; sb->s_flags |= MS_NOATIME;
sb->s_root->d_op = &msdos_dentry_operations; sb->s_root->d_op = &msdos_dentry_operations;
unlock_kernel();
return 0; return 0;
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/namei.h> #include <linux/namei.h>
#include <linux/smp_lock.h> /* For lock_kernel() */
#include "fat.h" #include "fat.h"
/* /*
...@@ -1055,15 +1056,19 @@ static int vfat_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1055,15 +1056,19 @@ static int vfat_fill_super(struct super_block *sb, void *data, int silent)
{ {
int res; int res;
lock_kernel();
res = fat_fill_super(sb, data, silent, &vfat_dir_inode_operations, 1); res = fat_fill_super(sb, data, silent, &vfat_dir_inode_operations, 1);
if (res) if (res) {
unlock_kernel();
return res; return res;
}
if (MSDOS_SB(sb)->options.name_check != 's') if (MSDOS_SB(sb)->options.name_check != 's')
sb->s_root->d_op = &vfat_ci_dentry_ops; sb->s_root->d_op = &vfat_ci_dentry_ops;
else else
sb->s_root->d_op = &vfat_dentry_ops; sb->s_root->d_op = &vfat_dentry_ops;
unlock_kernel();
return 0; return 0;
} }
......
...@@ -148,7 +148,7 @@ static int vxfs_remount(struct super_block *sb, int *flags, char *data) ...@@ -148,7 +148,7 @@ static int vxfs_remount(struct super_block *sb, int *flags, char *data)
* The superblock on success, else %NULL. * The superblock on success, else %NULL.
* *
* Locking: * Locking:
* We are under the bkl and @sbp->s_lock. * We are under @sbp->s_lock.
*/ */
static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
{ {
...@@ -159,11 +159,14 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) ...@@ -159,11 +159,14 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
struct inode *root; struct inode *root;
int ret = -EINVAL; int ret = -EINVAL;
lock_kernel();
sbp->s_flags |= MS_RDONLY; sbp->s_flags |= MS_RDONLY;
infp = kzalloc(sizeof(*infp), GFP_KERNEL); infp = kzalloc(sizeof(*infp), GFP_KERNEL);
if (!infp) { if (!infp) {
printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n"); printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n");
unlock_kernel();
return -ENOMEM; return -ENOMEM;
} }
...@@ -236,6 +239,7 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) ...@@ -236,6 +239,7 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
goto out_free_ilist; goto out_free_ilist;
} }
unlock_kernel();
return 0; return 0;
out_free_ilist: out_free_ilist:
...@@ -245,6 +249,7 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) ...@@ -245,6 +249,7 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
out: out:
brelse(bp); brelse(bp);
kfree(infp); kfree(infp);
unlock_kernel();
return ret; return ret;
} }
......
...@@ -382,9 +382,13 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -382,9 +382,13 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
struct inode *root_inode; struct inode *root_inode;
int res; int res;
lock_kernel();
sbi = kzalloc(sizeof(struct hfs_sb_info), GFP_KERNEL); sbi = kzalloc(sizeof(struct hfs_sb_info), GFP_KERNEL);
if (!sbi) if (!sbi) {
unlock_kernel();
return -ENOMEM; return -ENOMEM;
}
sb->s_fs_info = sbi; sb->s_fs_info = sbi;
INIT_HLIST_HEAD(&sbi->rsrc_inodes); INIT_HLIST_HEAD(&sbi->rsrc_inodes);
...@@ -435,6 +439,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -435,6 +439,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_root->d_op = &hfs_dentry_operations; sb->s_root->d_op = &hfs_dentry_operations;
/* everything's okay */ /* everything's okay */
unlock_kernel();
return 0; return 0;
bail_iput: bail_iput:
...@@ -443,6 +448,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -443,6 +448,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
printk(KERN_ERR "hfs: get root inode failed.\n"); printk(KERN_ERR "hfs: get root inode failed.\n");
bail: bail:
hfs_mdb_put(sb); hfs_mdb_put(sb);
unlock_kernel();
return res; return res;
} }
......
...@@ -477,11 +477,15 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) ...@@ -477,11 +477,15 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
int o; int o;
lock_kernel();
save_mount_options(s, options); save_mount_options(s, options);
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi) if (!sbi) {
unlock_kernel();
return -ENOMEM; return -ENOMEM;
}
s->s_fs_info = sbi; s->s_fs_info = sbi;
sbi->sb_bmp_dir = NULL; sbi->sb_bmp_dir = NULL;
...@@ -666,6 +670,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) ...@@ -666,6 +670,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
root->i_blocks = 5; root->i_blocks = 5;
hpfs_brelse4(&qbh); hpfs_brelse4(&qbh);
} }
unlock_kernel();
return 0; return 0;
bail4: brelse(bh2); bail4: brelse(bh2);
...@@ -677,6 +682,7 @@ bail2: brelse(bh0); ...@@ -677,6 +682,7 @@ bail2: brelse(bh0);
kfree(sbi->sb_cp_table); kfree(sbi->sb_cp_table);
s->s_fs_info = NULL; s->s_fs_info = NULL;
kfree(sbi); kfree(sbi);
unlock_kernel();
return -EINVAL; return -EINVAL;
} }
......
...@@ -571,11 +571,15 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) ...@@ -571,11 +571,15 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
int table, error = -EINVAL; int table, error = -EINVAL;
unsigned int vol_desc_start; unsigned int vol_desc_start;
lock_kernel();
save_mount_options(s, data); save_mount_options(s, data);
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi) if (!sbi) {
unlock_kernel();
return -ENOMEM; return -ENOMEM;
}
s->s_fs_info = sbi; s->s_fs_info = sbi;
if (!parse_options((char *)data, &opt)) if (!parse_options((char *)data, &opt))
...@@ -900,6 +904,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) ...@@ -900,6 +904,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
kfree(opt.iocharset); kfree(opt.iocharset);
unlock_kernel();
return 0; return 0;
/* /*
...@@ -939,6 +944,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) ...@@ -939,6 +944,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
kfree(opt.iocharset); kfree(opt.iocharset);
kfree(sbi); kfree(sbi);
s->s_fs_info = NULL; s->s_fs_info = NULL;
unlock_kernel();
return error; return error;
} }
......
...@@ -146,14 +146,19 @@ static const struct super_operations jffs2_super_operations = ...@@ -146,14 +146,19 @@ static const struct super_operations jffs2_super_operations =
static int jffs2_fill_super(struct super_block *sb, void *data, int silent) static int jffs2_fill_super(struct super_block *sb, void *data, int silent)
{ {
struct jffs2_sb_info *c; struct jffs2_sb_info *c;
int ret;
lock_kernel();
D1(printk(KERN_DEBUG "jffs2_get_sb_mtd():" D1(printk(KERN_DEBUG "jffs2_get_sb_mtd():"
" New superblock for device %d (\"%s\")\n", " New superblock for device %d (\"%s\")\n",
sb->s_mtd->index, sb->s_mtd->name)); sb->s_mtd->index, sb->s_mtd->name));
c = kzalloc(sizeof(*c), GFP_KERNEL); c = kzalloc(sizeof(*c), GFP_KERNEL);
if (!c) if (!c) {
unlock_kernel();
return -ENOMEM; return -ENOMEM;
}
c->mtd = sb->s_mtd; c->mtd = sb->s_mtd;
c->os_priv = sb; c->os_priv = sb;
...@@ -175,7 +180,9 @@ static int jffs2_fill_super(struct super_block *sb, void *data, int silent) ...@@ -175,7 +180,9 @@ static int jffs2_fill_super(struct super_block *sb, void *data, int silent)
#ifdef CONFIG_JFFS2_FS_POSIX_ACL #ifdef CONFIG_JFFS2_FS_POSIX_ACL
sb->s_flags |= MS_POSIXACL; sb->s_flags |= MS_POSIXACL;
#endif #endif
return jffs2_do_fill_super(sb, data, silent); ret = jffs2_do_fill_super(sb, data, silent);
unlock_kernel();
return ret;
} }
static int jffs2_get_sb(struct file_system_type *fs_type, static int jffs2_get_sb(struct file_system_type *fs_type,
......
...@@ -438,14 +438,20 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -438,14 +438,20 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
s64 newLVSize = 0; s64 newLVSize = 0;
int flag, ret = -EINVAL; int flag, ret = -EINVAL;
lock_kernel();
jfs_info("In jfs_read_super: s_flags=0x%lx", sb->s_flags); jfs_info("In jfs_read_super: s_flags=0x%lx", sb->s_flags);
if (!new_valid_dev(sb->s_bdev->bd_dev)) if (!new_valid_dev(sb->s_bdev->bd_dev)) {
unlock_kernel();
return -EOVERFLOW; return -EOVERFLOW;
}
sbi = kzalloc(sizeof (struct jfs_sb_info), GFP_KERNEL); sbi = kzalloc(sizeof (struct jfs_sb_info), GFP_KERNEL);
if (!sbi) if (!sbi) {
unlock_kernel();
return -ENOMEM; return -ENOMEM;
}
sb->s_fs_info = sbi; sb->s_fs_info = sbi;
sbi->sb = sb; sbi->sb = sb;
sbi->uid = sbi->gid = sbi->umask = -1; 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,6 +548,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, (u64)sb->s_maxbytes); sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, (u64)sb->s_maxbytes);
#endif #endif
sb->s_time_gran = 1; sb->s_time_gran = 1;
unlock_kernel();
return 0; return 0;
out_no_root: out_no_root:
...@@ -564,6 +571,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -564,6 +571,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
unload_nls(sbi->nls_tab); unload_nls(sbi->nls_tab);
out_kfree: out_kfree:
kfree(sbi); kfree(sbi);
unlock_kernel();
return ret; return ret;
} }
......
...@@ -1113,9 +1113,12 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags, ...@@ -1113,9 +1113,12 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
if (!(flags & MS_RDONLY)) if (!(flags & MS_RDONLY))
mode |= FMODE_WRITE; mode |= FMODE_WRITE;
lock_kernel();
sd.bdev = open_bdev_exclusive(dev_name, mode, fs_type); sd.bdev = open_bdev_exclusive(dev_name, mode, fs_type);
if (IS_ERR(sd.bdev)) if (IS_ERR(sd.bdev)) {
unlock_kernel();
return PTR_ERR(sd.bdev); return PTR_ERR(sd.bdev);
}
/* /*
* To get mount instance using sget() vfs-routine, NILFS needs * 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,6 +1201,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
if (need_to_close) if (need_to_close)
close_bdev_exclusive(sd.bdev, mode); close_bdev_exclusive(sd.bdev, mode);
simple_set_mnt(mnt, s); simple_set_mnt(mnt, s);
unlock_kernel();
return 0; return 0;
failed_unlock: failed_unlock:
...@@ -1206,6 +1210,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags, ...@@ -1206,6 +1210,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
failed: failed:
close_bdev_exclusive(sd.bdev, mode); close_bdev_exclusive(sd.bdev, mode);
unlock_kernel();
return err; return err;
cancel_new: cancel_new:
...@@ -1218,6 +1223,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags, ...@@ -1218,6 +1223,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
* We must finish all post-cleaning before this call; * We must finish all post-cleaning before this call;
* put_nilfs() needs the block device. * put_nilfs() needs the block device.
*/ */
unlock_kernel();
return err; return err;
} }
......
...@@ -2732,6 +2732,8 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) ...@@ -2732,6 +2732,8 @@ 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
...@@ -2755,6 +2757,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) ...@@ -2755,6 +2757,7 @@ 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. */
...@@ -2942,6 +2945,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) ...@@ -2942,6 +2945,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
sb->s_export_op = &ntfs_export_ops; sb->s_export_op = &ntfs_export_ops;
lock_kernel(); 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.");
...@@ -3062,6 +3066,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) ...@@ -3062,6 +3066,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
kfree(vol); kfree(vol);
ntfs_debug("Failed, returning -EINVAL."); ntfs_debug("Failed, returning -EINVAL.");
lockdep_on(); lockdep_on();
unlock_kernel();
return -EINVAL; return -EINVAL;
} }
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/backing-dev.h> #include <linux/backing-dev.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -588,21 +589,27 @@ static int dlmfs_fill_super(struct super_block * sb, ...@@ -588,21 +589,27 @@ static int dlmfs_fill_super(struct super_block * sb,
struct inode * inode; struct inode * inode;
struct dentry * root; struct dentry * root;
lock_kernel();
sb->s_maxbytes = MAX_LFS_FILESIZE; sb->s_maxbytes = MAX_LFS_FILESIZE;
sb->s_blocksize = PAGE_CACHE_SIZE; sb->s_blocksize = PAGE_CACHE_SIZE;
sb->s_blocksize_bits = PAGE_CACHE_SHIFT; sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
sb->s_magic = DLMFS_MAGIC; sb->s_magic = DLMFS_MAGIC;
sb->s_op = &dlmfs_ops; sb->s_op = &dlmfs_ops;
inode = dlmfs_get_root_inode(sb); inode = dlmfs_get_root_inode(sb);
if (!inode) if (!inode) {
unlock_kernel();
return -ENOMEM; return -ENOMEM;
}
root = d_alloc_root(inode); root = d_alloc_root(inode);
if (!root) { if (!root) {
iput(inode); iput(inode);
unlock_kernel();
return -ENOMEM; return -ENOMEM;
} }
sb->s_root = root; sb->s_root = root;
unlock_kernel();
return 0; return 0;
} }
......
...@@ -1002,6 +1002,8 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1002,6 +1002,8 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
char nodestr[8]; char nodestr[8];
struct ocfs2_blockcheck_stats stats; struct ocfs2_blockcheck_stats stats;
lock_kernel();
mlog_entry("%p, %p, %i", sb, data, silent); mlog_entry("%p, %p, %i", sb, data, silent);
if (!ocfs2_parse_options(sb, data, &parsed_options, 0)) { 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,6 +1181,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
atomic_set(&osb->vol_state, VOLUME_DISABLED); atomic_set(&osb->vol_state, VOLUME_DISABLED);
wake_up(&osb->osb_mount_event); wake_up(&osb->osb_mount_event);
mlog_exit(status); mlog_exit(status);
unlock_kernel();
return status; return status;
} }
} }
...@@ -1193,6 +1196,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1193,6 +1196,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
ocfs2_orphan_scan_start(osb); ocfs2_orphan_scan_start(osb);
mlog_exit(status); mlog_exit(status);
unlock_kernel();
return status; return status;
read_super_error: read_super_error:
...@@ -1208,6 +1212,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1208,6 +1212,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
} }
mlog_exit(status); mlog_exit(status);
unlock_kernel();
return status; return status;
} }
......
...@@ -234,9 +234,13 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent) ...@@ -234,9 +234,13 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
struct qnx4_sb_info *qs; struct qnx4_sb_info *qs;
int ret = -EINVAL; int ret = -EINVAL;
lock_kernel();
qs = kzalloc(sizeof(struct qnx4_sb_info), GFP_KERNEL); qs = kzalloc(sizeof(struct qnx4_sb_info), GFP_KERNEL);
if (!qs) if (!qs) {
unlock_kernel();
return -ENOMEM; return -ENOMEM;
}
s->s_fs_info = qs; s->s_fs_info = qs;
sb_set_blocksize(s, QNX4_BLOCK_SIZE); 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,6 +288,7 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
brelse(bh); brelse(bh);
unlock_kernel();
return 0; return 0;
outi: outi:
...@@ -293,6 +298,7 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent) ...@@ -293,6 +298,7 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
outnobh: outnobh:
kfree(qs); kfree(qs);
s->s_fs_info = NULL; s->s_fs_info = NULL;
unlock_kernel();
return ret; return ret;
} }
......
...@@ -501,6 +501,8 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) ...@@ -501,6 +501,8 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
void *mem; void *mem;
static int warn_count; static int warn_count;
lock_kernel();
if (warn_count < 5) { if (warn_count < 5) {
warn_count++; warn_count++;
printk(KERN_EMERG "smbfs is deprecated and will be removed" 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,6 +623,7 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
smb_new_dentry(sb->s_root); smb_new_dentry(sb->s_root);
unlock_kernel();
return 0; return 0;
out_no_root: out_no_root:
...@@ -643,9 +646,11 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) ...@@ -643,9 +646,11 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
out_no_data: out_no_data:
printk(KERN_ERR "smb_fill_super: missing data argument\n"); printk(KERN_ERR "smb_fill_super: missing data argument\n");
out_fail: out_fail:
unlock_kernel();
return -EINVAL; return -EINVAL;
out_no_server: out_no_server:
printk(KERN_ERR "smb_fill_super: cannot allocate struct smb_sb_info\n"); printk(KERN_ERR "smb_fill_super: cannot allocate struct smb_sb_info\n");
unlock_kernel();
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -87,11 +87,14 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -87,11 +87,14 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
u64 lookup_table_start, xattr_id_table_start; u64 lookup_table_start, xattr_id_table_start;
int err; int err;
lock_kernel();
TRACE("Entered squashfs_fill_superblock\n"); TRACE("Entered squashfs_fill_superblock\n");
sb->s_fs_info = kzalloc(sizeof(*msblk), GFP_KERNEL); sb->s_fs_info = kzalloc(sizeof(*msblk), GFP_KERNEL);
if (sb->s_fs_info == NULL) { if (sb->s_fs_info == NULL) {
ERROR("Failed to allocate squashfs_sb_info\n"); ERROR("Failed to allocate squashfs_sb_info\n");
unlock_kernel();
return -ENOMEM; return -ENOMEM;
} }
msblk = sb->s_fs_info; msblk = sb->s_fs_info;
...@@ -301,6 +304,7 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -301,6 +304,7 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
TRACE("Leaving squashfs_fill_super\n"); TRACE("Leaving squashfs_fill_super\n");
kfree(sblk); kfree(sblk);
unlock_kernel();
return 0; return 0;
failed_mount: failed_mount:
...@@ -315,11 +319,13 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -315,11 +319,13 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
kfree(sb->s_fs_info); kfree(sb->s_fs_info);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
kfree(sblk); kfree(sblk);
unlock_kernel();
return err; return err;
failure: failure:
kfree(sb->s_fs_info); kfree(sb->s_fs_info);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
unlock_kernel();
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -1880,6 +1880,8 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) ...@@ -1880,6 +1880,8 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
struct kernel_lb_addr rootdir, fileset; struct kernel_lb_addr rootdir, fileset;
struct udf_sb_info *sbi; struct udf_sb_info *sbi;
lock_kernel();
uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT); uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT);
uopt.uid = -1; uopt.uid = -1;
uopt.gid = -1; uopt.gid = -1;
...@@ -1888,8 +1890,10 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) ...@@ -1888,8 +1890,10 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
uopt.dmode = UDF_INVALID_MODE; uopt.dmode = UDF_INVALID_MODE;
sbi = kzalloc(sizeof(struct udf_sb_info), GFP_KERNEL); sbi = kzalloc(sizeof(struct udf_sb_info), GFP_KERNEL);
if (!sbi) if (!sbi) {
unlock_kernel();
return -ENOMEM; return -ENOMEM;
}
sb->s_fs_info = sbi; sb->s_fs_info = sbi;
...@@ -2035,6 +2039,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) ...@@ -2035,6 +2039,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
goto error_out; goto error_out;
} }
sb->s_maxbytes = MAX_LFS_FILESIZE; sb->s_maxbytes = MAX_LFS_FILESIZE;
unlock_kernel();
return 0; return 0;
error_out: error_out:
...@@ -2055,6 +2060,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) ...@@ -2055,6 +2060,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
kfree(sbi); kfree(sbi);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
unlock_kernel();
return -EINVAL; return -EINVAL;
} }
......
...@@ -696,6 +696,8 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -696,6 +696,8 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
unsigned maxsymlen; unsigned maxsymlen;
int ret = -EINVAL; int ret = -EINVAL;
lock_kernel();
uspi = NULL; uspi = NULL;
ubh = NULL; ubh = NULL;
flags = 0; flags = 0;
...@@ -1163,6 +1165,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1163,6 +1165,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
goto failed; goto failed;
UFSD("EXIT\n"); UFSD("EXIT\n");
unlock_kernel();
return 0; return 0;
dalloc_failed: dalloc_failed:
...@@ -1174,10 +1177,12 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1174,10 +1177,12 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
kfree(sbi); kfree(sbi);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
UFSD("EXIT (FAILED)\n"); UFSD("EXIT (FAILED)\n");
unlock_kernel();
return ret; return ret;
failed_nomem: failed_nomem:
UFSD("EXIT (NOMEM)\n"); UFSD("EXIT (NOMEM)\n");
unlock_kernel();
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -1430,6 +1430,8 @@ static int cgroup_get_sb(struct file_system_type *fs_type, ...@@ -1430,6 +1430,8 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
struct super_block *sb; struct super_block *sb;
struct cgroupfs_root *new_root; struct cgroupfs_root *new_root;
lock_kernel();
/* First find the desired set of subsystems */ /* First find the desired set of subsystems */
mutex_lock(&cgroup_mutex); mutex_lock(&cgroup_mutex);
ret = parse_cgroupfs_options(data, &opts); ret = parse_cgroupfs_options(data, &opts);
...@@ -1559,6 +1561,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type, ...@@ -1559,6 +1561,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
simple_set_mnt(mnt, sb); simple_set_mnt(mnt, sb);
kfree(opts.release_agent); kfree(opts.release_agent);
kfree(opts.name); kfree(opts.name);
unlock_kernel();
return 0; return 0;
drop_new_super: drop_new_super:
...@@ -1568,6 +1571,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type, ...@@ -1568,6 +1571,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
out_err: out_err:
kfree(opts.release_agent); kfree(opts.release_agent);
kfree(opts.name); kfree(opts.name);
unlock_kernel();
return ret; return ret;
} }
......
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