提交 6cfd0148 编写于 作者: C Christoph Hellwig 提交者: Al Viro

push BKL down into ->put_super

Move BKL into ->put_super from the only caller.  A couple of
filesystems had trivial enough ->put_super (only kfree and NULLing of
s_fs_info + stuff in there) to not get any locking: coda, cramfs, efs,
hugetlbfs, omfs, qnx4, shmem, all others got the full treatment.  Most
of them probably don't need it, but I'd rather sort that out individually.
Preferably after all the other BKL pushdowns in that area.

[AV: original used to move lock_super() down as well; these changes are
removed since we don't do lock_super() at all in generic_shutdown_super()
now]
[AV: fuse, btrfs and xfs are known to need no damn BKL, exempt]
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 a9e220f8
...@@ -132,11 +132,15 @@ static void adfs_put_super(struct super_block *sb) ...@@ -132,11 +132,15 @@ static void adfs_put_super(struct super_block *sb)
int i; int i;
struct adfs_sb_info *asb = ADFS_SB(sb); struct adfs_sb_info *asb = ADFS_SB(sb);
lock_kernel();
for (i = 0; i < asb->s_map_size; i++) for (i = 0; i < asb->s_map_size; i++)
brelse(asb->s_map[i].dm_bh); brelse(asb->s_map[i].dm_bh);
kfree(asb->s_map); kfree(asb->s_map);
kfree(asb); kfree(asb);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
unlock_kernel();
} }
static int adfs_show_options(struct seq_file *seq, struct vfsmount *mnt) static int adfs_show_options(struct seq_file *seq, struct vfsmount *mnt)
......
...@@ -29,6 +29,8 @@ affs_put_super(struct super_block *sb) ...@@ -29,6 +29,8 @@ affs_put_super(struct super_block *sb)
struct affs_sb_info *sbi = AFFS_SB(sb); struct affs_sb_info *sbi = AFFS_SB(sb);
pr_debug("AFFS: put_super()\n"); pr_debug("AFFS: put_super()\n");
lock_kernel();
if (!(sb->s_flags & MS_RDONLY)) { if (!(sb->s_flags & MS_RDONLY)) {
AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = cpu_to_be32(1); AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = cpu_to_be32(1);
secs_to_datestamp(get_seconds(), secs_to_datestamp(get_seconds(),
...@@ -42,7 +44,8 @@ affs_put_super(struct super_block *sb) ...@@ -42,7 +44,8 @@ affs_put_super(struct super_block *sb)
affs_brelse(sbi->s_root_bh); affs_brelse(sbi->s_root_bh);
kfree(sbi); kfree(sbi);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
return;
unlock_kernel();
} }
static void static void
......
...@@ -440,8 +440,12 @@ static void afs_put_super(struct super_block *sb) ...@@ -440,8 +440,12 @@ static void afs_put_super(struct super_block *sb)
_enter(""); _enter("");
lock_kernel();
afs_put_volume(as->volume); afs_put_volume(as->volume);
unlock_kernel();
_leave(""); _leave("");
} }
......
...@@ -737,6 +737,8 @@ parse_options(char *options, befs_mount_options * opts) ...@@ -737,6 +737,8 @@ parse_options(char *options, befs_mount_options * opts)
static void static void
befs_put_super(struct super_block *sb) befs_put_super(struct super_block *sb)
{ {
lock_kernel();
kfree(BEFS_SB(sb)->mount_opts.iocharset); kfree(BEFS_SB(sb)->mount_opts.iocharset);
BEFS_SB(sb)->mount_opts.iocharset = NULL; BEFS_SB(sb)->mount_opts.iocharset = NULL;
...@@ -747,7 +749,8 @@ befs_put_super(struct super_block *sb) ...@@ -747,7 +749,8 @@ befs_put_super(struct super_block *sb)
kfree(sb->s_fs_info); kfree(sb->s_fs_info);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
return;
unlock_kernel();
} }
/* Allocate private field of the superblock, fill it. /* Allocate private field of the superblock, fill it.
......
...@@ -217,6 +217,8 @@ static void bfs_put_super(struct super_block *s) ...@@ -217,6 +217,8 @@ static void bfs_put_super(struct super_block *s)
if (!info) if (!info)
return; return;
lock_kernel();
if (s->s_dirt) if (s->s_dirt)
bfs_write_super(s); bfs_write_super(s);
...@@ -225,6 +227,8 @@ static void bfs_put_super(struct super_block *s) ...@@ -225,6 +227,8 @@ static void bfs_put_super(struct super_block *s)
kfree(info->si_imap); kfree(info->si_imap);
kfree(info); kfree(info);
s->s_fs_info = NULL; s->s_fs_info = NULL;
unlock_kernel();
} }
static int bfs_statfs(struct dentry *dentry, struct kstatfs *buf) static int bfs_statfs(struct dentry *dentry, struct kstatfs *buf)
......
...@@ -204,6 +204,9 @@ cifs_put_super(struct super_block *sb) ...@@ -204,6 +204,9 @@ cifs_put_super(struct super_block *sb)
cFYI(1, ("Empty cifs superblock info passed to unmount")); cFYI(1, ("Empty cifs superblock info passed to unmount"));
return; return;
} }
lock_kernel();
rc = cifs_umount(sb, cifs_sb); rc = cifs_umount(sb, cifs_sb);
if (rc) if (rc)
cERROR(1, ("cifs_umount failed with return code %d", rc)); cERROR(1, ("cifs_umount failed with return code %d", rc));
...@@ -216,7 +219,8 @@ cifs_put_super(struct super_block *sb) ...@@ -216,7 +219,8 @@ cifs_put_super(struct super_block *sb)
unload_nls(cifs_sb->local_nls); unload_nls(cifs_sb->local_nls);
kfree(cifs_sb); kfree(cifs_sb);
return;
unlock_kernel();
} }
static int static int
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/key.h> #include <linux/key.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/smp_lock.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include "ecryptfs_kernel.h" #include "ecryptfs_kernel.h"
...@@ -120,9 +121,13 @@ static void ecryptfs_put_super(struct super_block *sb) ...@@ -120,9 +121,13 @@ static void ecryptfs_put_super(struct super_block *sb)
{ {
struct ecryptfs_sb_info *sb_info = ecryptfs_superblock_to_private(sb); struct ecryptfs_sb_info *sb_info = ecryptfs_superblock_to_private(sb);
lock_kernel();
ecryptfs_destroy_mount_crypt_stat(&sb_info->mount_crypt_stat); ecryptfs_destroy_mount_crypt_stat(&sb_info->mount_crypt_stat);
kmem_cache_free(ecryptfs_sb_info_cache, sb_info); kmem_cache_free(ecryptfs_sb_info_cache, sb_info);
ecryptfs_set_superblock_private(sb, NULL); ecryptfs_set_superblock_private(sb, NULL);
unlock_kernel();
} }
/** /**
......
...@@ -258,6 +258,8 @@ static void exofs_put_super(struct super_block *sb) ...@@ -258,6 +258,8 @@ static void exofs_put_super(struct super_block *sb)
int num_pend; int num_pend;
struct exofs_sb_info *sbi = sb->s_fs_info; struct exofs_sb_info *sbi = sb->s_fs_info;
lock_kernel();
if (sb->s_dirt) if (sb->s_dirt)
exofs_write_super(sb); exofs_write_super(sb);
...@@ -274,6 +276,8 @@ static void exofs_put_super(struct super_block *sb) ...@@ -274,6 +276,8 @@ static void exofs_put_super(struct super_block *sb)
osduld_put_device(sbi->s_dev); osduld_put_device(sbi->s_dev);
kfree(sb->s_fs_info); kfree(sb->s_fs_info);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
unlock_kernel();
} }
/* /*
......
...@@ -114,6 +114,8 @@ static void ext2_put_super (struct super_block * sb) ...@@ -114,6 +114,8 @@ static void ext2_put_super (struct super_block * sb)
int i; int i;
struct ext2_sb_info *sbi = EXT2_SB(sb); struct ext2_sb_info *sbi = EXT2_SB(sb);
lock_kernel();
if (sb->s_dirt) if (sb->s_dirt)
ext2_write_super(sb); ext2_write_super(sb);
...@@ -138,7 +140,7 @@ static void ext2_put_super (struct super_block * sb) ...@@ -138,7 +140,7 @@ static void ext2_put_super (struct super_block * sb)
kfree(sbi->s_blockgroup_lock); kfree(sbi->s_blockgroup_lock);
kfree(sbi); kfree(sbi);
return; unlock_kernel();
} }
static struct kmem_cache * ext2_inode_cachep; static struct kmem_cache * ext2_inode_cachep;
......
...@@ -398,6 +398,8 @@ static void ext3_put_super (struct super_block * sb) ...@@ -398,6 +398,8 @@ static void ext3_put_super (struct super_block * sb)
struct ext3_super_block *es = sbi->s_es; struct ext3_super_block *es = sbi->s_es;
int i, err; int i, err;
lock_kernel();
ext3_xattr_put_super(sb); ext3_xattr_put_super(sb);
err = journal_destroy(sbi->s_journal); err = journal_destroy(sbi->s_journal);
sbi->s_journal = NULL; sbi->s_journal = NULL;
...@@ -446,7 +448,8 @@ static void ext3_put_super (struct super_block * sb) ...@@ -446,7 +448,8 @@ static void ext3_put_super (struct super_block * sb)
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
kfree(sbi->s_blockgroup_lock); kfree(sbi->s_blockgroup_lock);
kfree(sbi); kfree(sbi);
return;
unlock_kernel();
} }
static struct kmem_cache *ext3_inode_cachep; static struct kmem_cache *ext3_inode_cachep;
......
...@@ -577,6 +577,7 @@ static void ext4_put_super(struct super_block *sb) ...@@ -577,6 +577,7 @@ static void ext4_put_super(struct super_block *sb)
int i, err; int i, err;
lock_super(sb); lock_super(sb);
lock_kernel();
if (sb->s_dirt) if (sb->s_dirt)
ext4_write_super(sb); ext4_write_super(sb);
...@@ -646,7 +647,6 @@ static void ext4_put_super(struct super_block *sb) ...@@ -646,7 +647,6 @@ static void ext4_put_super(struct super_block *sb)
unlock_super(sb); unlock_super(sb);
kobject_put(&sbi->s_kobj); kobject_put(&sbi->s_kobj);
wait_for_completion(&sbi->s_kobj_unregister); wait_for_completion(&sbi->s_kobj_unregister);
lock_kernel();
kfree(sbi->s_blockgroup_lock); kfree(sbi->s_blockgroup_lock);
kfree(sbi); kfree(sbi);
} }
......
...@@ -451,6 +451,8 @@ static void fat_put_super(struct super_block *sb) ...@@ -451,6 +451,8 @@ static void fat_put_super(struct super_block *sb)
{ {
struct msdos_sb_info *sbi = MSDOS_SB(sb); struct msdos_sb_info *sbi = MSDOS_SB(sb);
lock_kernel();
if (sb->s_dirt) if (sb->s_dirt)
fat_write_super(sb); fat_write_super(sb);
...@@ -470,6 +472,8 @@ static void fat_put_super(struct super_block *sb) ...@@ -470,6 +472,8 @@ static void fat_put_super(struct super_block *sb)
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
kfree(sbi); kfree(sbi);
unlock_kernel();
} }
static struct kmem_cache *fat_inode_cachep; static struct kmem_cache *fat_inode_cachep;
......
...@@ -80,12 +80,16 @@ vxfs_put_super(struct super_block *sbp) ...@@ -80,12 +80,16 @@ vxfs_put_super(struct super_block *sbp)
{ {
struct vxfs_sb_info *infp = VXFS_SBI(sbp); struct vxfs_sb_info *infp = VXFS_SBI(sbp);
lock_kernel();
vxfs_put_fake_inode(infp->vsi_fship); vxfs_put_fake_inode(infp->vsi_fship);
vxfs_put_fake_inode(infp->vsi_ilist); vxfs_put_fake_inode(infp->vsi_ilist);
vxfs_put_fake_inode(infp->vsi_stilist); vxfs_put_fake_inode(infp->vsi_stilist);
brelse(infp->vsi_bp); brelse(infp->vsi_bp);
kfree(infp); kfree(infp);
unlock_kernel();
} }
/** /**
......
...@@ -719,6 +719,8 @@ static void gfs2_put_super(struct super_block *sb) ...@@ -719,6 +719,8 @@ static void gfs2_put_super(struct super_block *sb)
int error; int error;
struct gfs2_jdesc *jd; struct gfs2_jdesc *jd;
lock_kernel();
/* Unfreeze the filesystem, if we need to */ /* Unfreeze the filesystem, if we need to */
mutex_lock(&sdp->sd_freeze_lock); mutex_lock(&sdp->sd_freeze_lock);
...@@ -785,6 +787,8 @@ static void gfs2_put_super(struct super_block *sb) ...@@ -785,6 +787,8 @@ static void gfs2_put_super(struct super_block *sb)
/* At this point, we're through participating in the lockspace */ /* At this point, we're through participating in the lockspace */
gfs2_sys_fs_del(sdp); gfs2_sys_fs_del(sdp);
unlock_kernel();
} }
/** /**
......
...@@ -65,11 +65,15 @@ static void hfs_write_super(struct super_block *sb) ...@@ -65,11 +65,15 @@ static void hfs_write_super(struct super_block *sb)
*/ */
static void hfs_put_super(struct super_block *sb) static void hfs_put_super(struct super_block *sb)
{ {
lock_kernel();
if (sb->s_dirt) if (sb->s_dirt)
hfs_write_super(sb); hfs_write_super(sb);
hfs_mdb_close(sb); hfs_mdb_close(sb);
/* release the MDB's resources */ /* release the MDB's resources */
hfs_mdb_put(sb); hfs_mdb_put(sb);
unlock_kernel();
} }
/* /*
......
...@@ -199,6 +199,9 @@ static void hfsplus_put_super(struct super_block *sb) ...@@ -199,6 +199,9 @@ static void hfsplus_put_super(struct super_block *sb)
dprint(DBG_SUPER, "hfsplus_put_super\n"); dprint(DBG_SUPER, "hfsplus_put_super\n");
if (!sb->s_fs_info) if (!sb->s_fs_info)
return; return;
lock_kernel();
if (sb->s_dirt) if (sb->s_dirt)
hfsplus_write_super(sb); hfsplus_write_super(sb);
if (!(sb->s_flags & MS_RDONLY) && HFSPLUS_SB(sb).s_vhdr) { if (!(sb->s_flags & MS_RDONLY) && HFSPLUS_SB(sb).s_vhdr) {
...@@ -220,6 +223,8 @@ static void hfsplus_put_super(struct super_block *sb) ...@@ -220,6 +223,8 @@ static void hfsplus_put_super(struct super_block *sb)
unload_nls(HFSPLUS_SB(sb).nls); unload_nls(HFSPLUS_SB(sb).nls);
kfree(sb->s_fs_info); kfree(sb->s_fs_info);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
unlock_kernel();
} }
static int hfsplus_statfs(struct dentry *dentry, struct kstatfs *buf) static int hfsplus_statfs(struct dentry *dentry, struct kstatfs *buf)
......
...@@ -99,11 +99,16 @@ int hpfs_stop_cycles(struct super_block *s, int key, int *c1, int *c2, ...@@ -99,11 +99,16 @@ int hpfs_stop_cycles(struct super_block *s, int key, int *c1, int *c2,
static void hpfs_put_super(struct super_block *s) static void hpfs_put_super(struct super_block *s)
{ {
struct hpfs_sb_info *sbi = hpfs_sb(s); struct hpfs_sb_info *sbi = hpfs_sb(s);
lock_kernel();
kfree(sbi->sb_cp_table); kfree(sbi->sb_cp_table);
kfree(sbi->sb_bmp_dir); kfree(sbi->sb_bmp_dir);
unmark_dirty(s); unmark_dirty(s);
s->s_fs_info = NULL; s->s_fs_info = NULL;
kfree(sbi); kfree(sbi);
unlock_kernel();
} }
unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno) unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno)
......
...@@ -42,11 +42,16 @@ static int isofs_dentry_cmp_ms(struct dentry *dentry, struct qstr *a, struct qst ...@@ -42,11 +42,16 @@ static int isofs_dentry_cmp_ms(struct dentry *dentry, struct qstr *a, struct qst
static void isofs_put_super(struct super_block *sb) static void isofs_put_super(struct super_block *sb)
{ {
struct isofs_sb_info *sbi = ISOFS_SB(sb); struct isofs_sb_info *sbi = ISOFS_SB(sb);
#ifdef CONFIG_JOLIET #ifdef CONFIG_JOLIET
lock_kernel();
if (sbi->s_nls_iocharset) { if (sbi->s_nls_iocharset) {
unload_nls(sbi->s_nls_iocharset); unload_nls(sbi->s_nls_iocharset);
sbi->s_nls_iocharset = NULL; sbi->s_nls_iocharset = NULL;
} }
unlock_kernel();
#endif #endif
kfree(sbi); kfree(sbi);
......
...@@ -174,6 +174,8 @@ static void jffs2_put_super (struct super_block *sb) ...@@ -174,6 +174,8 @@ static void jffs2_put_super (struct super_block *sb)
D2(printk(KERN_DEBUG "jffs2: jffs2_put_super()\n")); D2(printk(KERN_DEBUG "jffs2: jffs2_put_super()\n"));
lock_kernel();
if (sb->s_dirt) if (sb->s_dirt)
jffs2_write_super(sb); jffs2_write_super(sb);
...@@ -195,6 +197,8 @@ static void jffs2_put_super (struct super_block *sb) ...@@ -195,6 +197,8 @@ static void jffs2_put_super (struct super_block *sb)
if (c->mtd->sync) if (c->mtd->sync)
c->mtd->sync(c->mtd); c->mtd->sync(c->mtd);
unlock_kernel();
D1(printk(KERN_DEBUG "jffs2_put_super returning\n")); D1(printk(KERN_DEBUG "jffs2_put_super returning\n"));
} }
......
...@@ -183,6 +183,9 @@ static void jfs_put_super(struct super_block *sb) ...@@ -183,6 +183,9 @@ static void jfs_put_super(struct super_block *sb)
int rc; int rc;
jfs_info("In jfs_put_super"); jfs_info("In jfs_put_super");
lock_kernel();
rc = jfs_umount(sb); rc = jfs_umount(sb);
if (rc) if (rc)
jfs_err("jfs_umount failed with return code %d", rc); jfs_err("jfs_umount failed with return code %d", rc);
...@@ -195,6 +198,8 @@ static void jfs_put_super(struct super_block *sb) ...@@ -195,6 +198,8 @@ static void jfs_put_super(struct super_block *sb)
sbi->direct_inode = NULL; sbi->direct_inode = NULL;
kfree(sbi); kfree(sbi);
unlock_kernel();
} }
enum { enum {
......
...@@ -35,6 +35,8 @@ static void minix_put_super(struct super_block *sb) ...@@ -35,6 +35,8 @@ static void minix_put_super(struct super_block *sb)
int i; int i;
struct minix_sb_info *sbi = minix_sb(sb); struct minix_sb_info *sbi = minix_sb(sb);
lock_kernel();
if (!(sb->s_flags & MS_RDONLY)) { if (!(sb->s_flags & MS_RDONLY)) {
if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */
sbi->s_ms->s_state = sbi->s_mount_state; sbi->s_ms->s_state = sbi->s_mount_state;
...@@ -49,7 +51,7 @@ static void minix_put_super(struct super_block *sb) ...@@ -49,7 +51,7 @@ static void minix_put_super(struct super_block *sb)
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
kfree(sbi); kfree(sbi);
return; unlock_kernel();
} }
static struct kmem_cache * minix_inode_cachep; static struct kmem_cache * minix_inode_cachep;
......
...@@ -736,6 +736,8 @@ static void ncp_put_super(struct super_block *sb) ...@@ -736,6 +736,8 @@ static void ncp_put_super(struct super_block *sb)
{ {
struct ncp_server *server = NCP_SBP(sb); struct ncp_server *server = NCP_SBP(sb);
lock_kernel();
ncp_lock_server(server); ncp_lock_server(server);
ncp_disconnect(server); ncp_disconnect(server);
ncp_unlock_server(server); ncp_unlock_server(server);
...@@ -769,6 +771,8 @@ static void ncp_put_super(struct super_block *sb) ...@@ -769,6 +771,8 @@ static void ncp_put_super(struct super_block *sb)
vfree(server->packet); vfree(server->packet);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
kfree(server); kfree(server);
unlock_kernel();
} }
static int ncp_statfs(struct dentry *dentry, struct kstatfs *buf) static int ncp_statfs(struct dentry *dentry, struct kstatfs *buf)
......
...@@ -316,6 +316,8 @@ static void nilfs_put_super(struct super_block *sb) ...@@ -316,6 +316,8 @@ static void nilfs_put_super(struct super_block *sb)
struct nilfs_sb_info *sbi = NILFS_SB(sb); struct nilfs_sb_info *sbi = NILFS_SB(sb);
struct the_nilfs *nilfs = sbi->s_nilfs; struct the_nilfs *nilfs = sbi->s_nilfs;
lock_kernel();
if (sb->s_dirt) if (sb->s_dirt)
nilfs_write_super(sb); nilfs_write_super(sb);
...@@ -333,6 +335,8 @@ static void nilfs_put_super(struct super_block *sb) ...@@ -333,6 +335,8 @@ static void nilfs_put_super(struct super_block *sb)
sbi->s_super = NULL; sbi->s_super = NULL;
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
kfree(sbi); kfree(sbi);
unlock_kernel();
} }
/** /**
......
...@@ -2246,6 +2246,9 @@ static void ntfs_put_super(struct super_block *sb) ...@@ -2246,6 +2246,9 @@ static void ntfs_put_super(struct super_block *sb)
ntfs_volume *vol = NTFS_SB(sb); ntfs_volume *vol = NTFS_SB(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
...@@ -2444,7 +2447,8 @@ static void ntfs_put_super(struct super_block *sb) ...@@ -2444,7 +2447,8 @@ static void ntfs_put_super(struct super_block *sb)
} }
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
kfree(vol); kfree(vol);
return;
unlock_kernel();
} }
/** /**
......
...@@ -1536,9 +1536,13 @@ static void ocfs2_put_super(struct super_block *sb) ...@@ -1536,9 +1536,13 @@ static void ocfs2_put_super(struct super_block *sb)
{ {
mlog_entry("(0x%p)\n", sb); mlog_entry("(0x%p)\n", sb);
lock_kernel();
ocfs2_sync_blockdev(sb); ocfs2_sync_blockdev(sb);
ocfs2_dismount_volume(sb, 0); ocfs2_dismount_volume(sb, 0);
unlock_kernel();
mlog_exit_void(); mlog_exit_void();
} }
......
...@@ -465,6 +465,8 @@ static void reiserfs_put_super(struct super_block *s) ...@@ -465,6 +465,8 @@ static void reiserfs_put_super(struct super_block *s)
struct reiserfs_transaction_handle th; struct reiserfs_transaction_handle th;
th.t_trans_id = 0; th.t_trans_id = 0;
lock_kernel();
if (s->s_dirt) if (s->s_dirt)
reiserfs_write_super(s); reiserfs_write_super(s);
...@@ -500,7 +502,7 @@ static void reiserfs_put_super(struct super_block *s) ...@@ -500,7 +502,7 @@ static void reiserfs_put_super(struct super_block *s)
kfree(s->s_fs_info); kfree(s->s_fs_info);
s->s_fs_info = NULL; s->s_fs_info = NULL;
return; unlock_kernel();
} }
static struct kmem_cache *reiserfs_inode_cachep; static struct kmem_cache *reiserfs_inode_cachep;
......
...@@ -474,6 +474,8 @@ smb_put_super(struct super_block *sb) ...@@ -474,6 +474,8 @@ smb_put_super(struct super_block *sb)
{ {
struct smb_sb_info *server = SMB_SB(sb); struct smb_sb_info *server = SMB_SB(sb);
lock_kernel();
smb_lock_server(server); smb_lock_server(server);
server->state = CONN_INVALID; server->state = CONN_INVALID;
smbiod_unregister_server(server); smbiod_unregister_server(server);
...@@ -489,6 +491,8 @@ smb_put_super(struct super_block *sb) ...@@ -489,6 +491,8 @@ smb_put_super(struct super_block *sb)
smb_unlock_server(server); smb_unlock_server(server);
put_pid(server->conn_pid); put_pid(server->conn_pid);
kfree(server); kfree(server);
unlock_kernel();
} }
static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
......
...@@ -338,6 +338,8 @@ static int squashfs_remount(struct super_block *sb, int *flags, char *data) ...@@ -338,6 +338,8 @@ static int squashfs_remount(struct super_block *sb, int *flags, char *data)
static void squashfs_put_super(struct super_block *sb) static void squashfs_put_super(struct super_block *sb)
{ {
lock_kernel();
if (sb->s_fs_info) { if (sb->s_fs_info) {
struct squashfs_sb_info *sbi = sb->s_fs_info; struct squashfs_sb_info *sbi = sb->s_fs_info;
squashfs_cache_delete(sbi->block_cache); squashfs_cache_delete(sbi->block_cache);
...@@ -350,6 +352,8 @@ static void squashfs_put_super(struct super_block *sb) ...@@ -350,6 +352,8 @@ static void squashfs_put_super(struct super_block *sb)
kfree(sb->s_fs_info); kfree(sb->s_fs_info);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
} }
unlock_kernel();
} }
......
...@@ -309,7 +309,6 @@ void generic_shutdown_super(struct super_block *sb) ...@@ -309,7 +309,6 @@ void generic_shutdown_super(struct super_block *sb)
/* bad name - it should be evict_inodes() */ /* bad name - it should be evict_inodes() */
invalidate_inodes(sb); invalidate_inodes(sb);
lock_kernel();
if (sop->put_super) if (sop->put_super)
sop->put_super(sb); sop->put_super(sb);
...@@ -320,8 +319,6 @@ void generic_shutdown_super(struct super_block *sb) ...@@ -320,8 +319,6 @@ void generic_shutdown_super(struct super_block *sb)
"Self-destruct in 5 seconds. Have a nice day...\n", "Self-destruct in 5 seconds. Have a nice day...\n",
sb->s_id); sb->s_id);
} }
unlock_kernel();
put_fs_excl(); put_fs_excl();
} }
spin_lock(&sb_lock); spin_lock(&sb_lock);
......
...@@ -72,6 +72,8 @@ static void sysv_put_super(struct super_block *sb) ...@@ -72,6 +72,8 @@ static void sysv_put_super(struct super_block *sb)
{ {
struct sysv_sb_info *sbi = SYSV_SB(sb); struct sysv_sb_info *sbi = SYSV_SB(sb);
lock_kernel();
if (sb->s_dirt) if (sb->s_dirt)
sysv_write_super(sb); sysv_write_super(sb);
...@@ -87,6 +89,8 @@ static void sysv_put_super(struct super_block *sb) ...@@ -87,6 +89,8 @@ static void sysv_put_super(struct super_block *sb)
brelse(sbi->s_bh2); brelse(sbi->s_bh2);
kfree(sbi); kfree(sbi);
unlock_kernel();
} }
static int sysv_statfs(struct dentry *dentry, struct kstatfs *buf) static int sysv_statfs(struct dentry *dentry, struct kstatfs *buf)
......
...@@ -1684,6 +1684,9 @@ static void ubifs_put_super(struct super_block *sb) ...@@ -1684,6 +1684,9 @@ static void ubifs_put_super(struct super_block *sb)
ubifs_msg("un-mount UBI device %d, volume %d", c->vi.ubi_num, ubifs_msg("un-mount UBI device %d, volume %d", c->vi.ubi_num,
c->vi.vol_id); c->vi.vol_id);
lock_kernel();
/* /*
* The following asserts are only valid if there has not been a failure * The following asserts are only valid if there has not been a failure
* of the media. For example, there will be dirty inodes if we failed * of the media. For example, there will be dirty inodes if we failed
...@@ -1750,6 +1753,8 @@ static void ubifs_put_super(struct super_block *sb) ...@@ -1750,6 +1753,8 @@ static void ubifs_put_super(struct super_block *sb)
ubi_close_volume(c->ubi); ubi_close_volume(c->ubi);
mutex_unlock(&c->umount_mutex); mutex_unlock(&c->umount_mutex);
kfree(c); kfree(c);
unlock_kernel();
} }
static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
......
...@@ -2062,6 +2062,9 @@ static void udf_put_super(struct super_block *sb) ...@@ -2062,6 +2062,9 @@ static void udf_put_super(struct super_block *sb)
struct udf_sb_info *sbi; struct udf_sb_info *sbi;
sbi = UDF_SB(sb); sbi = UDF_SB(sb);
lock_kernel();
if (sbi->s_vat_inode) if (sbi->s_vat_inode)
iput(sbi->s_vat_inode); iput(sbi->s_vat_inode);
if (sbi->s_partitions) if (sbi->s_partitions)
...@@ -2077,6 +2080,8 @@ static void udf_put_super(struct super_block *sb) ...@@ -2077,6 +2080,8 @@ static void udf_put_super(struct super_block *sb)
kfree(sbi->s_partmaps); kfree(sbi->s_partmaps);
kfree(sb->s_fs_info); kfree(sb->s_fs_info);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
unlock_kernel();
} }
static int udf_sync_fs(struct super_block *sb, int wait) static int udf_sync_fs(struct super_block *sb, int wait)
......
...@@ -594,6 +594,9 @@ static void ufs_put_super_internal(struct super_block *sb) ...@@ -594,6 +594,9 @@ static void ufs_put_super_internal(struct super_block *sb)
UFSD("ENTER\n"); UFSD("ENTER\n");
lock_kernel();
ufs_put_cstotal(sb); ufs_put_cstotal(sb);
size = uspi->s_cssize; size = uspi->s_cssize;
blks = (size + uspi->s_fsize - 1) >> uspi->s_fshift; blks = (size + uspi->s_fsize - 1) >> uspi->s_fshift;
...@@ -621,6 +624,9 @@ static void ufs_put_super_internal(struct super_block *sb) ...@@ -621,6 +624,9 @@ static void ufs_put_super_internal(struct super_block *sb)
brelse (sbi->s_ucg[i]); brelse (sbi->s_ucg[i]);
kfree (sbi->s_ucg); kfree (sbi->s_ucg);
kfree (base); kfree (base);
unlock_kernel();
UFSD("EXIT\n"); UFSD("EXIT\n");
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册