@@ -763,11 +763,11 @@ static int spufs_init_fs_context(struct fs_context *fc)
}
static struct file_system_type spufs_type = {
- .owner = THIS_MODULE,
- .name = "spufs",
- .init_fs_context = spufs_init_fs_context,
- .parameters = spufs_fs_parameters,
- .kill_sb = kill_litter_super,
+ .owner = THIS_MODULE,
+ .name = "spufs",
+ .init_fs_context = spufs_init_fs_context,
+ .parameters = spufs_fs_parameters,
+ .shutdown_sb = litter_shutdown_sb,
};
MODULE_ALIAS_FS("spufs");
@@ -294,9 +294,8 @@ static int hypfs_init_fs_context(struct fs_context *fc)
return 0;
}
-static void hypfs_kill_super(struct super_block *sb)
+static void hypfs_free_sb(struct super_block *sb)
{
- kill_litter_super(sb);
kfree(sb->s_fs_info);
}
@@ -417,7 +416,8 @@ static struct file_system_type hypfs_type = {
.name = "s390_hypfs",
.init_fs_context = hypfs_init_fs_context,
.parameters = hypfs_fs_parameters,
- .kill_sb = hypfs_kill_super
+ .shutdown_sb = litter_shutdown_sb,
+ .free_sb = hypfs_free_sb,
};
static const struct super_operations hypfs_s_ops = {
@@ -771,19 +771,12 @@ static int binderfs_init_fs_context(struct fs_context *fc)
return 0;
}
-static void binderfs_kill_super(struct super_block *sb)
+static void binderfs_free_sb(struct super_block *sb)
{
struct binderfs_info *info = sb->s_fs_info;
- /*
- * During inode eviction struct binderfs_info is needed.
- * So first wipe the super_block then free struct binderfs_info.
- */
- kill_litter_super(sb);
-
if (info && info->ipc_ns)
put_ipc_ns(info->ipc_ns);
-
kfree(info);
}
@@ -791,7 +784,8 @@ static struct file_system_type binder_fs_type = {
.name = "binder",
.init_fs_context = binderfs_init_fs_context,
.parameters = binderfs_fs_parameters,
- .kill_sb = binderfs_kill_super,
+ .shutdown_sb = litter_shutdown_sb,
+ .free_sb = binderfs_free_sb,
.fs_flags = FS_USERNS_MOUNT,
};
@@ -80,13 +80,13 @@ static struct dentry *public_dev_mount(struct file_system_type *fs_type, int fla
}
static struct file_system_type internal_fs_type = {
- .name = "devtmpfs",
+ .name = "devtmpfs",
#ifdef CONFIG_TMPFS
- .init_fs_context = shmem_init_fs_context,
+ .init_fs_context = shmem_init_fs_context,
#else
- .init_fs_context = ramfs_init_fs_context,
+ .init_fs_context = ramfs_init_fs_context,
#endif
- .kill_sb = kill_litter_super,
+ .shutdown_sb = litter_shutdown_sb,
};
static struct file_system_type dev_fs_type = {
@@ -473,7 +473,7 @@ static struct file_system_type qibfs_fs_type = {
.owner = THIS_MODULE,
.name = "ipathfs",
.init_fs_context = qibfs_init_fs_context,
- .kill_sb = kill_litter_super,
+ .shutdown_sb = litter_shutdown_sb,
};
MODULE_ALIAS_FS("ipathfs");
@@ -100,10 +100,10 @@ static const struct super_operations ibmasmfs_s_ops = {
static const struct file_operations *ibmasmfs_dir_ops = &simple_dir_operations;
static struct file_system_type ibmasmfs_type = {
- .owner = THIS_MODULE,
- .name = "ibmasmfs",
- .init_fs_context = ibmasmfs_init_fs_context,
- .kill_sb = kill_litter_super,
+ .owner = THIS_MODULE,
+ .name = "ibmasmfs",
+ .init_fs_context = ibmasmfs_init_fs_context,
+ .shutdown_sb = litter_shutdown_sb,
};
MODULE_ALIAS_FS("ibmasmfs");
@@ -1602,9 +1602,8 @@ static int ffs_fs_init_fs_context(struct fs_context *fc)
}
static void
-ffs_fs_kill_sb(struct super_block *sb)
+ffs_fs_free_sb(struct super_block *sb)
{
- kill_litter_super(sb);
if (sb->s_fs_info)
ffs_data_closed(sb->s_fs_info);
}
@@ -1614,7 +1613,8 @@ static struct file_system_type ffs_fs_type = {
.name = "functionfs",
.init_fs_context = ffs_fs_init_fs_context,
.parameters = ffs_fs_fs_parameters,
- .kill_sb = ffs_fs_kill_sb,
+ .shutdown_sb = litter_shutdown_sb,
+ .free_sb = ffs_fs_free_sb,
};
MODULE_ALIAS_FS("functionfs");
@@ -2086,9 +2086,8 @@ static int gadgetfs_init_fs_context(struct fs_context *fc)
}
static void
-gadgetfs_kill_sb (struct super_block *sb)
+gadgetfs_free_sb(struct super_block *sb)
{
- kill_litter_super (sb);
if (the_device) {
put_dev (the_device);
the_device = NULL;
@@ -2100,10 +2099,11 @@ gadgetfs_kill_sb (struct super_block *sb)
/*----------------------------------------------------------------------*/
static struct file_system_type gadgetfs_type = {
- .owner = THIS_MODULE,
- .name = shortname,
- .init_fs_context = gadgetfs_init_fs_context,
- .kill_sb = gadgetfs_kill_sb,
+ .owner = THIS_MODULE,
+ .name = shortname,
+ .init_fs_context = gadgetfs_init_fs_context,
+ .shutdown_sb = litter_shutdown_sb,
+ .free_sb = gadgetfs_free_sb,
};
MODULE_ALIAS_FS("gadgetfs");
@@ -85,10 +85,10 @@ static int xenfs_init_fs_context(struct fs_context *fc)
}
static struct file_system_type xenfs_type = {
- .owner = THIS_MODULE,
- .name = "xenfs",
- .init_fs_context = xenfs_init_fs_context,
- .kill_sb = kill_litter_super,
+ .owner = THIS_MODULE,
+ .name = "xenfs",
+ .init_fs_context = xenfs_init_fs_context,
+ .shutdown_sb = litter_shutdown_sb,
};
MODULE_ALIAS_FS("xenfs");
@@ -809,10 +809,10 @@ static struct linux_binfmt misc_format = {
};
static struct file_system_type bm_fs_type = {
- .owner = THIS_MODULE,
- .name = "binfmt_misc",
- .init_fs_context = bm_init_fs_context,
- .kill_sb = kill_litter_super,
+ .owner = THIS_MODULE,
+ .name = "binfmt_misc",
+ .init_fs_context = bm_init_fs_context,
+ .shutdown_sb = litter_shutdown_sb,
};
MODULE_ALIAS_FS("binfmt_misc");
@@ -112,10 +112,10 @@ static int configfs_init_fs_context(struct fs_context *fc)
}
static struct file_system_type configfs_fs_type = {
- .owner = THIS_MODULE,
- .name = "configfs",
- .init_fs_context = configfs_init_fs_context,
- .kill_sb = kill_litter_super,
+ .owner = THIS_MODULE,
+ .name = "configfs",
+ .init_fs_context = configfs_init_fs_context,
+ .shutdown_sb = litter_shutdown_sb,
};
MODULE_ALIAS_FS("configfs");
@@ -300,10 +300,10 @@ static struct dentry *debug_mount(struct file_system_type *fs_type,
}
static struct file_system_type debug_fs_type = {
- .owner = THIS_MODULE,
- .name = "debugfs",
- .mount = debug_mount,
- .kill_sb = kill_litter_super,
+ .owner = THIS_MODULE,
+ .name = "debugfs",
+ .mount = debug_mount,
+ .shutdown_sb = litter_shutdown_sb,
};
MODULE_ALIAS_FS("debugfs");
@@ -487,11 +487,10 @@ static struct dentry *devpts_mount(struct file_system_type *fs_type,
return mount_nodev(fs_type, flags, data, devpts_fill_super);
}
-static void devpts_kill_sb(struct super_block *sb)
+static void devpts_free_sb(struct super_block *sb)
{
struct pts_fs_info *fsi = DEVPTS_SB(sb);
- kill_litter_super(sb);
if (fsi)
ida_destroy(&fsi->allocated_ptys);
kfree(fsi);
@@ -500,7 +499,8 @@ static void devpts_kill_sb(struct super_block *sb)
static struct file_system_type devpts_fs_type = {
.name = "devpts",
.mount = devpts_mount,
- .kill_sb = devpts_kill_sb,
+ .shutdown_sb = litter_shutdown_sb,
+ .free_sb = devpts_free_sb,
.fs_flags = FS_USERNS_MOUNT,
};
@@ -279,10 +279,8 @@ static int efivarfs_init_fs_context(struct fs_context *fc)
return 0;
}
-static void efivarfs_kill_sb(struct super_block *sb)
+static void efivarfs_free_sb(struct super_block *sb)
{
- kill_litter_super(sb);
-
if (!efivar_is_available())
return;
@@ -291,10 +289,11 @@ static void efivarfs_kill_sb(struct super_block *sb)
}
static struct file_system_type efivarfs_type = {
- .owner = THIS_MODULE,
- .name = "efivarfs",
- .init_fs_context = efivarfs_init_fs_context,
- .kill_sb = efivarfs_kill_sb,
+ .owner = THIS_MODULE,
+ .name = "efivarfs",
+ .init_fs_context = efivarfs_init_fs_context,
+ .shutdown_sb = litter_shutdown_sb,
+ .free_sb = efivarfs_free_sb,
};
static __init int efivarfs_init(void)
@@ -352,7 +352,7 @@ static int fuse_ctl_init_fs_context(struct fs_context *fsc)
return 0;
}
-static void fuse_ctl_kill_sb(struct super_block *sb)
+static void fuse_ctl_shutdown_sb(struct super_block *sb)
{
struct fuse_conn *fc;
@@ -362,14 +362,14 @@ static void fuse_ctl_kill_sb(struct super_block *sb)
fc->ctl_ndents = 0;
mutex_unlock(&fuse_mutex);
- kill_litter_super(sb);
+ litter_shutdown_sb(sb);
}
static struct file_system_type fuse_ctl_fs_type = {
- .owner = THIS_MODULE,
- .name = "fusectl",
- .init_fs_context = fuse_ctl_init_fs_context,
- .kill_sb = fuse_ctl_kill_sb,
+ .owner = THIS_MODULE,
+ .name = "fusectl",
+ .init_fs_context = fuse_ctl_init_fs_context,
+ .shutdown_sb = fuse_ctl_shutdown_sb,
};
MODULE_ALIAS_FS("fusectl");
@@ -1588,7 +1588,7 @@ static struct file_system_type hugetlbfs_fs_type = {
.name = "hugetlbfs",
.init_fs_context = hugetlbfs_init_fs_context,
.parameters = hugetlb_fs_parameters,
- .kill_sb = kill_litter_super,
+ .shutdown_sb = litter_shutdown_sb,
};
static struct vfsmount *hugetlbfs_vfsmount[HUGE_MAX_HSTATE];
@@ -1440,21 +1440,23 @@ static int nfsd_init_fs_context(struct fs_context *fc)
return 0;
}
-static void nfsd_umount(struct super_block *sb)
+static void nfsd_shutdown_sb(struct super_block *sb)
{
- struct net *net = sb->s_fs_info;
-
- nfsd_shutdown_threads(net);
+ nfsd_shutdown_threads(sb->s_fs_info);
+ litter_shutdown_sb(sb);
+}
- kill_litter_super(sb);
- put_net(net);
+static void nfsd_free_sb(struct super_block *sb)
+{
+ put_net(sb->s_fs_info);
}
static struct file_system_type nfsd_fs_type = {
- .owner = THIS_MODULE,
- .name = "nfsd",
- .init_fs_context = nfsd_init_fs_context,
- .kill_sb = nfsd_umount,
+ .owner = THIS_MODULE,
+ .name = "nfsd",
+ .init_fs_context = nfsd_init_fs_context,
+ .shutdown_sb = nfsd_shutdown_sb,
+ .free_sb = nfsd_free_sb,
};
MODULE_ALIAS_FS("nfsd");
@@ -567,7 +567,7 @@ static struct file_system_type dlmfs_fs_type = {
.owner = THIS_MODULE,
.name = "ocfs2_dlmfs",
.mount = dlmfs_mount,
- .kill_sb = kill_litter_super,
+ .shutdown_sb = litter_shutdown_sb,
};
MODULE_ALIAS_FS("ocfs2_dlmfs");
@@ -465,10 +465,8 @@ static struct dentry *pstore_mount(struct file_system_type *fs_type,
return mount_single(fs_type, flags, data, pstore_fill_super);
}
-static void pstore_kill_sb(struct super_block *sb)
+static void pstore_free_sb(struct super_block *sb)
{
- kill_litter_super(sb);
-
mutex_lock(&pstore_sb_lock);
pstore_sb = NULL;
@@ -483,7 +481,8 @@ static struct file_system_type pstore_fs_type = {
.owner = THIS_MODULE,
.name = "pstore",
.mount = pstore_mount,
- .kill_sb = pstore_kill_sb,
+ .shutdown_sb = litter_shutdown_sb,
+ .free_sb = pstore_free_sb,
};
int __init pstore_init_fs(void)
@@ -278,9 +278,8 @@ int ramfs_init_fs_context(struct fs_context *fc)
return 0;
}
-void ramfs_kill_sb(struct super_block *sb)
+void ramfs_free_sb(struct super_block *sb)
{
- kill_litter_super(sb);
kfree(sb->s_fs_info);
}
@@ -288,7 +287,8 @@ static struct file_system_type ramfs_fs_type = {
.name = "ramfs",
.init_fs_context = ramfs_init_fs_context,
.parameters = ramfs_fs_parameters,
- .kill_sb = ramfs_kill_sb,
+ .shutdown_sb = litter_shutdown_sb,
+ .free_sb = ramfs_free_sb,
.fs_flags = FS_USERNS_MOUNT,
};
@@ -1319,13 +1319,21 @@ void free_anon_bdev(dev_t dev)
}
EXPORT_SYMBOL(free_anon_bdev);
-void kill_litter_super(struct super_block *sb)
+/**
+ * litter_shutdown_sb - shut down a super_block that only has synthetic files
+ * @sb: super_block to shut down
+ *
+ * This function is a drop in ->shutdown_sb method and calls d_genocide() to
+ * drop all entries in the dcache. It is used for file systems that only
+ * contained synthetic, that is kernel-generated, entries created by helpers
+ * like simple_fill_super().
+ */
+void litter_shutdown_sb(struct super_block *sb)
{
if (sb->s_root)
d_genocide(sb->s_root);
- generic_shutdown_super(sb);
}
-EXPORT_SYMBOL(kill_litter_super);
+EXPORT_SYMBOL(litter_shutdown_sb);
static int test_keyed_super(struct super_block *sb, struct fs_context *fc)
{
@@ -438,7 +438,7 @@ static struct file_system_type trace_fs_type = {
.owner = THIS_MODULE,
.name = "tracefs",
.mount = trace_mount,
- .kill_sb = kill_litter_super,
+ .shutdown_sb = litter_shutdown_sb,
};
MODULE_ALIAS_FS("tracefs");
@@ -2384,7 +2384,7 @@ extern struct dentry *mount_subtree(struct vfsmount *mnt, const char *path);
void retire_super(struct super_block *sb);
void generic_shutdown_super(struct super_block *sb);
void kill_block_super(struct super_block *sb);
-void kill_litter_super(struct super_block *sb);
+void litter_shutdown_sb(struct super_block *sb);
void deactivate_super(struct super_block *sb);
void deactivate_locked_super(struct super_block *sb);
int get_anon_bdev(dev_t *);
@@ -7,7 +7,7 @@
struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir,
umode_t mode, dev_t dev);
extern int ramfs_init_fs_context(struct fs_context *fc);
-extern void ramfs_kill_sb(struct super_block *sb);
+void ramfs_free_sb(struct super_block *sb);
#ifdef CONFIG_MMU
static inline int
@@ -503,9 +503,9 @@ static int rootfs_init_fs_context(struct fs_context *fc)
}
struct file_system_type rootfs_fs_type = {
- .name = "rootfs",
- .init_fs_context = rootfs_init_fs_context,
- .kill_sb = kill_litter_super,
+ .name = "rootfs",
+ .init_fs_context = rootfs_init_fs_context,
+ .shutdown_sb = litter_shutdown_sb,
};
void __init init_rootfs(void)
@@ -1681,7 +1681,7 @@ static const struct fs_context_operations mqueue_fs_context_ops = {
static struct file_system_type mqueue_fs_type = {
.name = "mqueue",
.init_fs_context = mqueue_init_fs_context,
- .kill_sb = kill_litter_super,
+ .shutdown_sb = litter_shutdown_sb,
.fs_flags = FS_USERNS_MOUNT,
};
@@ -797,7 +797,7 @@ static struct file_system_type bpf_fs_type = {
.name = "bpf",
.init_fs_context = bpf_init_fs_context,
.parameters = bpf_fs_parameters,
- .kill_sb = kill_litter_super,
+ .shutdown_sb = litter_shutdown_sb,
};
static int __init bpf_init(void)
@@ -4584,7 +4584,7 @@ static struct file_system_type shmem_fs_type = {
#ifdef CONFIG_TMPFS
.parameters = shmem_fs_parameters,
#endif
- .kill_sb = kill_litter_super,
+ .shutdown_sb = litter_shutdown_sb,
#ifdef CONFIG_SHMEM
.fs_flags = FS_USERNS_MOUNT | FS_ALLOW_IDMAP | FS_MGTIME,
#else
@@ -4709,7 +4709,8 @@ static struct file_system_type shmem_fs_type = {
.name = "tmpfs",
.init_fs_context = ramfs_init_fs_context,
.parameters = ramfs_fs_parameters,
- .kill_sb = ramfs_kill_sb,
+ .shutdown_sb = litter_shutdown_sb,
+ .free_sb = ramfs_free_sb,
.fs_flags = FS_USERNS_MOUNT,
};
@@ -1441,7 +1441,7 @@ static int rpc_init_fs_context(struct fs_context *fc)
return 0;
}
-static void rpc_kill_sb(struct super_block *sb)
+static void rpc_shutdown_sb(struct super_block *sb)
{
struct net *net = sb->s_fs_info;
struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
@@ -1459,15 +1459,20 @@ static void rpc_kill_sb(struct super_block *sb)
sb);
mutex_unlock(&sn->pipefs_sb_lock);
out:
- kill_litter_super(sb);
- put_net(net);
+ litter_shutdown_sb(sb);
+}
+
+static void rpc_free_sb(struct super_block *sb)
+{
+ put_net(sb->s_fs_info);
}
static struct file_system_type rpc_pipe_fs_type = {
- .owner = THIS_MODULE,
- .name = "rpc_pipefs",
- .init_fs_context = rpc_init_fs_context,
- .kill_sb = rpc_kill_sb,
+ .owner = THIS_MODULE,
+ .name = "rpc_pipefs",
+ .init_fs_context = rpc_init_fs_context,
+ .shutdown_sb = rpc_shutdown_sb,
+ .free_sb = rpc_free_sb,
};
MODULE_ALIAS_FS("rpc_pipefs");
MODULE_ALIAS("rpc_pipefs");
@@ -67,10 +67,10 @@ static int securityfs_init_fs_context(struct fs_context *fc)
}
static struct file_system_type fs_type = {
- .owner = THIS_MODULE,
- .name = "securityfs",
- .init_fs_context = securityfs_init_fs_context,
- .kill_sb = kill_litter_super,
+ .owner = THIS_MODULE,
+ .name = "securityfs",
+ .init_fs_context = securityfs_init_fs_context,
+ .shutdown_sb = litter_shutdown_sb,
};
/**
@@ -94,7 +94,7 @@ static int selinux_fs_info_create(struct super_block *sb)
return 0;
}
-static void selinux_fs_info_free(struct super_block *sb)
+static void sel_free_sb(struct super_block *sb)
{
struct selinux_fs_info *fsi = sb->s_fs_info;
unsigned int i;
@@ -2120,16 +2120,11 @@ static int sel_init_fs_context(struct fs_context *fc)
return 0;
}
-static void sel_kill_sb(struct super_block *sb)
-{
- kill_litter_super(sb);
- selinux_fs_info_free(sb);
-}
-
static struct file_system_type sel_fs_type = {
- .name = "selinuxfs",
- .init_fs_context = sel_init_fs_context,
- .kill_sb = sel_kill_sb,
+ .name = "selinuxfs",
+ .init_fs_context = sel_init_fs_context,
+ .shutdown_sb = litter_shutdown_sb,
+ .free_sb = sel_free_sb,
};
static struct vfsmount *selinuxfs_mount __ro_after_init;
@@ -2979,9 +2979,9 @@ static int smk_init_fs_context(struct fs_context *fc)
}
static struct file_system_type smk_fs_type = {
- .name = "smackfs",
- .init_fs_context = smk_init_fs_context,
- .kill_sb = kill_litter_super,
+ .name = "smackfs",
+ .init_fs_context = smk_init_fs_context,
+ .shutdown_sb = litter_shutdown_sb,
};
static struct vfsmount *smackfs_mount;
Replace kill_litter_super with litter_shutdown_sb, which is wired up to the ->shutdown_sb method. For file systems that wrapped kill_litter_super, ->kill_sb is replaced with ->shutdown and ->free_sb methods as needed. Signed-off-by: Christoph Hellwig <hch@lst.de> --- arch/powerpc/platforms/cell/spufs/inode.c | 10 +++++----- arch/s390/hypfs/inode.c | 6 +++--- drivers/android/binderfs.c | 12 +++--------- drivers/base/devtmpfs.c | 8 ++++---- drivers/infiniband/hw/qib/qib_fs.c | 2 +- drivers/misc/ibmasm/ibmasmfs.c | 8 ++++---- drivers/usb/gadget/function/f_fs.c | 6 +++--- drivers/usb/gadget/legacy/inode.c | 12 ++++++------ drivers/xen/xenfs/super.c | 8 ++++---- fs/binfmt_misc.c | 8 ++++---- fs/configfs/mount.c | 8 ++++---- fs/debugfs/inode.c | 8 ++++---- fs/devpts/inode.c | 6 +++--- fs/efivarfs/super.c | 13 ++++++------- fs/fuse/control.c | 12 ++++++------ fs/hugetlbfs/inode.c | 2 +- fs/nfsd/nfsctl.c | 22 ++++++++++++---------- fs/ocfs2/dlmfs/dlmfs.c | 2 +- fs/pstore/inode.c | 7 +++---- fs/ramfs/inode.c | 6 +++--- fs/super.c | 14 +++++++++++--- fs/tracefs/inode.c | 2 +- include/linux/fs.h | 2 +- include/linux/ramfs.h | 2 +- init/do_mounts.c | 6 +++--- ipc/mqueue.c | 2 +- kernel/bpf/inode.c | 2 +- mm/shmem.c | 5 +++-- net/sunrpc/rpc_pipe.c | 19 ++++++++++++------- security/inode.c | 8 ++++---- security/selinux/selinuxfs.c | 15 +++++---------- security/smack/smackfs.c | 6 +++--- 32 files changed, 126 insertions(+), 123 deletions(-)