Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (29 commits)
  braino in internal.h
  convert simple cases of nfs-related ->get_sb() to ->mount()
  convert btrfs
  convert ceph
  convert gfs2
  convert afs
  convert ecryptfs
  convert sysfs
  convert cgroup and cpuset
  switch get_sb_ns() users
  switch procfs to ->mount()
  setting ->proc_mnt doesn't belong in proc_get_sb()
  convert cifs
  convert nilfs
  switch logfs to ->mount()
  logfs: fix a leak in get_sb
  logfs get_sb, part 3
  logfs get_sb, part 2
  logfs get_sb massage, part 1
  convert v9fs
  ...
This commit is contained in:
Linus Torvalds 2010-10-29 08:06:25 -07:00
commit 53113b06e4
102 changed files with 731 additions and 759 deletions

View File

@ -618,16 +618,15 @@ pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
} }
static int static struct dentry *
pfmfs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data, pfmfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)
struct vfsmount *mnt)
{ {
return get_sb_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC, mnt); return mount_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC);
} }
static struct file_system_type pfm_fs_type = { static struct file_system_type pfm_fs_type = {
.name = "pfmfs", .name = "pfmfs",
.get_sb = pfmfs_get_sb, .mount = pfmfs_mount,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
}; };

View File

@ -798,17 +798,17 @@ spufs_fill_super(struct super_block *sb, void *data, int silent)
return spufs_create_root(sb, data); return spufs_create_root(sb, data);
} }
static int static struct dentry *
spufs_get_sb(struct file_system_type *fstype, int flags, spufs_mount(struct file_system_type *fstype, int flags,
const char *name, void *data, struct vfsmount *mnt) const char *name, void *data)
{ {
return get_sb_single(fstype, flags, data, spufs_fill_super, mnt); return mount_single(fstype, flags, data, spufs_fill_super);
} }
static struct file_system_type spufs_type = { static struct file_system_type spufs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "spufs", .name = "spufs",
.get_sb = spufs_get_sb, .mount = spufs_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

View File

@ -316,10 +316,10 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
return 0; return 0;
} }
static int hypfs_get_super(struct file_system_type *fst, int flags, static struct dentry *hypfs_mount(struct file_system_type *fst, int flags,
const char *devname, void *data, struct vfsmount *mnt) const char *devname, void *data)
{ {
return get_sb_single(fst, flags, data, hypfs_fill_super, mnt); return mount_single(fst, flags, data, hypfs_fill_super);
} }
static void hypfs_kill_super(struct super_block *sb) static void hypfs_kill_super(struct super_block *sb)
@ -455,7 +455,7 @@ static const struct file_operations hypfs_file_ops = {
static struct file_system_type hypfs_type = { static struct file_system_type hypfs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "s390_hypfs", .name = "s390_hypfs",
.get_sb = hypfs_get_super, .mount = hypfs_mount,
.kill_sb = hypfs_kill_super .kill_sb = hypfs_kill_super
}; };

View File

@ -29,33 +29,33 @@
static struct vfsmount *dev_mnt; static struct vfsmount *dev_mnt;
#if defined CONFIG_DEVTMPFS_MOUNT #if defined CONFIG_DEVTMPFS_MOUNT
static int dev_mount = 1; static int mount_dev = 1;
#else #else
static int dev_mount; static int mount_dev;
#endif #endif
static DEFINE_MUTEX(dirlock); static DEFINE_MUTEX(dirlock);
static int __init mount_param(char *str) static int __init mount_param(char *str)
{ {
dev_mount = simple_strtoul(str, NULL, 0); mount_dev = simple_strtoul(str, NULL, 0);
return 1; return 1;
} }
__setup("devtmpfs.mount=", mount_param); __setup("devtmpfs.mount=", mount_param);
static int dev_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *dev_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, struct vfsmount *mnt) const char *dev_name, void *data)
{ {
#ifdef CONFIG_TMPFS #ifdef CONFIG_TMPFS
return get_sb_single(fs_type, flags, data, shmem_fill_super, mnt); return mount_single(fs_type, flags, data, shmem_fill_super);
#else #else
return get_sb_single(fs_type, flags, data, ramfs_fill_super, mnt); return mount_single(fs_type, flags, data, ramfs_fill_super);
#endif #endif
} }
static struct file_system_type dev_fs_type = { static struct file_system_type dev_fs_type = {
.name = "devtmpfs", .name = "devtmpfs",
.get_sb = dev_get_sb, .mount = dev_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };
@ -351,7 +351,7 @@ int devtmpfs_mount(const char *mntdir)
{ {
int err; int err;
if (!dev_mount) if (!mount_dev)
return 0; return 0;
if (!dev_mnt) if (!dev_mnt)

View File

@ -362,13 +362,13 @@ static int ipathfs_fill_super(struct super_block *sb, void *data,
return ret; return ret;
} }
static int ipathfs_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *ipathfs_mount(struct file_system_type *fs_type,
const char *dev_name, void *data, struct vfsmount *mnt) int flags, const char *dev_name, void *data)
{ {
int ret = get_sb_single(fs_type, flags, data, struct dentry *ret;
ipathfs_fill_super, mnt); ret = mount_single(fs_type, flags, data, ipathfs_fill_super);
if (ret >= 0) if (!IS_ERR(ret))
ipath_super = mnt->mnt_sb; ipath_super = ret->d_sb;
return ret; return ret;
} }
@ -411,7 +411,7 @@ int ipathfs_remove_device(struct ipath_devdata *dd)
static struct file_system_type ipathfs_fs_type = { static struct file_system_type ipathfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ipathfs", .name = "ipathfs",
.get_sb = ipathfs_get_sb, .mount = ipathfs_mount,
.kill_sb = ipathfs_kill_super, .kill_sb = ipathfs_kill_super,
}; };

View File

@ -555,13 +555,13 @@ static int qibfs_fill_super(struct super_block *sb, void *data, int silent)
return ret; return ret;
} }
static int qibfs_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *qibfs_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, struct vfsmount *mnt) const char *dev_name, void *data)
{ {
int ret = get_sb_single(fs_type, flags, data, struct dentry *ret;
qibfs_fill_super, mnt); ret = mount_single(fs_type, flags, data, qibfs_fill_super);
if (ret >= 0) if (!IS_ERR(ret))
qib_super = mnt->mnt_sb; qib_super = ret->d_sb;
return ret; return ret;
} }
@ -603,7 +603,7 @@ int qibfs_remove(struct qib_devdata *dd)
static struct file_system_type qibfs_fs_type = { static struct file_system_type qibfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ipathfs", .name = "ipathfs",
.get_sb = qibfs_get_sb, .mount = qibfs_mount,
.kill_sb = qibfs_kill_super, .kill_sb = qibfs_kill_super,
}; };

View File

@ -125,16 +125,16 @@ capifs_fill_super(struct super_block *s, void *data, int silent)
return -ENOMEM; return -ENOMEM;
} }
static int capifs_get_sb(struct file_system_type *fs_type, static struct dentry *capifs_mount(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)
{ {
return get_sb_single(fs_type, flags, data, capifs_fill_super, mnt); return mount_single(fs_type, flags, data, capifs_fill_super);
} }
static struct file_system_type capifs_fs_type = { static struct file_system_type capifs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "capifs", .name = "capifs",
.get_sb = capifs_get_sb, .mount = capifs_mount,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
}; };

View File

@ -91,11 +91,10 @@ static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root);
static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent); static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent);
static int ibmasmfs_get_super(struct file_system_type *fst, static struct dentry *ibmasmfs_mount(struct file_system_type *fst,
int flags, const char *name, void *data, int flags, const char *name, void *data)
struct vfsmount *mnt)
{ {
return get_sb_single(fst, flags, data, ibmasmfs_fill_super, mnt); return mount_single(fst, flags, data, ibmasmfs_fill_super);
} }
static const struct super_operations ibmasmfs_s_ops = { static const struct super_operations ibmasmfs_s_ops = {
@ -108,7 +107,7 @@ static const struct file_operations *ibmasmfs_dir_ops = &simple_dir_operations;
static struct file_system_type ibmasmfs_type = { static struct file_system_type ibmasmfs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ibmasmfs", .name = "ibmasmfs",
.get_sb = ibmasmfs_get_super, .mount = ibmasmfs_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

View File

@ -1030,17 +1030,15 @@ static const struct file_operations mtd_fops = {
#endif #endif
}; };
static int mtd_inodefs_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *mtd_inodefs_mount(struct file_system_type *fs_type,
const char *dev_name, void *data, int flags, const char *dev_name, void *data)
struct vfsmount *mnt)
{ {
return get_sb_pseudo(fs_type, "mtd_inode:", NULL, MTD_INODE_FS_MAGIC, return mount_pseudo(fs_type, "mtd_inode:", NULL, MTD_INODE_FS_MAGIC);
mnt);
} }
static struct file_system_type mtd_inodefs_type = { static struct file_system_type mtd_inodefs_type = {
.name = "mtd_inodefs", .name = "mtd_inodefs",
.get_sb = mtd_inodefs_get_sb, .mount = mtd_inodefs_mount,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
}; };

View File

@ -54,11 +54,10 @@ static int get_sb_mtd_set(struct super_block *sb, void *_mtd)
/* /*
* get a superblock on an MTD-backed filesystem * get a superblock on an MTD-backed filesystem
*/ */
static int get_sb_mtd_aux(struct file_system_type *fs_type, int flags, static struct dentry *mount_mtd_aux(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, const char *dev_name, void *data,
struct mtd_info *mtd, struct mtd_info *mtd,
int (*fill_super)(struct super_block *, void *, int), int (*fill_super)(struct super_block *, void *, int))
struct vfsmount *mnt)
{ {
struct super_block *sb; struct super_block *sb;
int ret; int ret;
@ -79,57 +78,49 @@ static int get_sb_mtd_aux(struct file_system_type *fs_type, int flags,
ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
if (ret < 0) { if (ret < 0) {
deactivate_locked_super(sb); deactivate_locked_super(sb);
return ret; return ERR_PTR(ret);
} }
/* go */ /* go */
sb->s_flags |= MS_ACTIVE; sb->s_flags |= MS_ACTIVE;
simple_set_mnt(mnt, sb); return dget(sb->s_root);
return 0;
/* new mountpoint for an already mounted superblock */ /* new mountpoint for an already mounted superblock */
already_mounted: already_mounted:
DEBUG(1, "MTDSB: Device %d (\"%s\") is already mounted\n", DEBUG(1, "MTDSB: Device %d (\"%s\") is already mounted\n",
mtd->index, mtd->name); mtd->index, mtd->name);
simple_set_mnt(mnt, sb); put_mtd_device(mtd);
ret = 0; return dget(sb->s_root);
goto out_put;
out_error: out_error:
ret = PTR_ERR(sb);
out_put:
put_mtd_device(mtd); put_mtd_device(mtd);
return ret; return ERR_CAST(sb);
} }
/* /*
* get a superblock on an MTD-backed filesystem by MTD device number * get a superblock on an MTD-backed filesystem by MTD device number
*/ */
static int get_sb_mtd_nr(struct file_system_type *fs_type, int flags, static struct dentry *mount_mtd_nr(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, int mtdnr, const char *dev_name, void *data, int mtdnr,
int (*fill_super)(struct super_block *, void *, int), int (*fill_super)(struct super_block *, void *, int))
struct vfsmount *mnt)
{ {
struct mtd_info *mtd; struct mtd_info *mtd;
mtd = get_mtd_device(NULL, mtdnr); mtd = get_mtd_device(NULL, mtdnr);
if (IS_ERR(mtd)) { if (IS_ERR(mtd)) {
DEBUG(0, "MTDSB: Device #%u doesn't appear to exist\n", mtdnr); DEBUG(0, "MTDSB: Device #%u doesn't appear to exist\n", mtdnr);
return PTR_ERR(mtd); return ERR_CAST(mtd);
} }
return get_sb_mtd_aux(fs_type, flags, dev_name, data, mtd, fill_super, return mount_mtd_aux(fs_type, flags, dev_name, data, mtd, fill_super);
mnt);
} }
/* /*
* set up an MTD-based superblock * set up an MTD-based superblock
*/ */
int get_sb_mtd(struct file_system_type *fs_type, int flags, struct dentry *mount_mtd(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, const char *dev_name, void *data,
int (*fill_super)(struct super_block *, void *, int), int (*fill_super)(struct super_block *, void *, int))
struct vfsmount *mnt)
{ {
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
struct block_device *bdev; struct block_device *bdev;
@ -138,7 +129,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
int mtdnr; int mtdnr;
if (!dev_name) if (!dev_name)
return -EINVAL; return ERR_PTR(-EINVAL);
DEBUG(2, "MTDSB: dev_name \"%s\"\n", dev_name); DEBUG(2, "MTDSB: dev_name \"%s\"\n", dev_name);
@ -156,10 +147,10 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
mtd = get_mtd_device_nm(dev_name + 4); mtd = get_mtd_device_nm(dev_name + 4);
if (!IS_ERR(mtd)) if (!IS_ERR(mtd))
return get_sb_mtd_aux( return mount_mtd_aux(
fs_type, flags, fs_type, flags,
dev_name, data, mtd, dev_name, data, mtd,
fill_super, mnt); fill_super);
printk(KERN_NOTICE "MTD:" printk(KERN_NOTICE "MTD:"
" MTD device with name \"%s\" not found.\n", " MTD device with name \"%s\" not found.\n",
@ -174,9 +165,9 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
/* It was a valid number */ /* It was a valid number */
DEBUG(1, "MTDSB: mtd%%d, mtdnr %d\n", DEBUG(1, "MTDSB: mtd%%d, mtdnr %d\n",
mtdnr); mtdnr);
return get_sb_mtd_nr(fs_type, flags, return mount_mtd_nr(fs_type, flags,
dev_name, data, dev_name, data,
mtdnr, fill_super, mnt); mtdnr, fill_super);
} }
} }
} }
@ -189,7 +180,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
if (IS_ERR(bdev)) { if (IS_ERR(bdev)) {
ret = PTR_ERR(bdev); ret = PTR_ERR(bdev);
DEBUG(1, "MTDSB: lookup_bdev() returned %d\n", ret); DEBUG(1, "MTDSB: lookup_bdev() returned %d\n", ret);
return ret; return ERR_PTR(ret);
} }
DEBUG(1, "MTDSB: lookup_bdev() returned 0\n"); DEBUG(1, "MTDSB: lookup_bdev() returned 0\n");
@ -202,8 +193,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
if (major != MTD_BLOCK_MAJOR) if (major != MTD_BLOCK_MAJOR)
goto not_an_MTD_device; goto not_an_MTD_device;
return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super, return mount_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super);
mnt);
not_an_MTD_device: not_an_MTD_device:
#endif /* CONFIG_BLOCK */ #endif /* CONFIG_BLOCK */
@ -212,10 +202,10 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
printk(KERN_NOTICE printk(KERN_NOTICE
"MTD: Attempt to mount non-MTD device \"%s\"\n", "MTD: Attempt to mount non-MTD device \"%s\"\n",
dev_name); dev_name);
return -EINVAL; return ERR_PTR(-EINVAL);
} }
EXPORT_SYMBOL_GPL(get_sb_mtd); EXPORT_SYMBOL_GPL(mount_mtd);
/* /*
* destroy an MTD-based superblock * destroy an MTD-based superblock

View File

@ -259,17 +259,17 @@ static int oprofilefs_fill_super(struct super_block *sb, void *data, int silent)
} }
static int oprofilefs_get_sb(struct file_system_type *fs_type, static struct dentry *oprofilefs_mount(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)
{ {
return get_sb_single(fs_type, flags, data, oprofilefs_fill_super, mnt); return mount_single(fs_type, flags, data, oprofilefs_fill_super);
} }
static struct file_system_type oprofilefs_type = { static struct file_system_type oprofilefs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "oprofilefs", .name = "oprofilefs",
.get_sb = oprofilefs_get_sb, .mount = oprofilefs_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

View File

@ -14,16 +14,16 @@
#include <linux/init.h> #include <linux/init.h>
#include "autofs_i.h" #include "autofs_i.h"
static int autofs_get_sb(struct file_system_type *fs_type, static struct dentry *autofs_mount(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)
{ {
return get_sb_nodev(fs_type, flags, data, autofs_fill_super, mnt); return mount_nodev(fs_type, flags, data, autofs_fill_super);
} }
static struct file_system_type autofs_fs_type = { static struct file_system_type autofs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "autofs", .name = "autofs",
.get_sb = autofs_get_sb, .mount = autofs_mount,
.kill_sb = autofs_kill_sb, .kill_sb = autofs_kill_sb,
}; };

View File

@ -1937,11 +1937,10 @@ static int pohmelfs_fill_super(struct super_block *sb, void *data, int silent)
/* /*
* Some VFS magic here... * Some VFS magic here...
*/ */
static int pohmelfs_get_sb(struct file_system_type *fs_type, static struct dentry *pohmelfs_mount(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)
{ {
return get_sb_nodev(fs_type, flags, data, pohmelfs_fill_super, return mount_nodev(fs_type, flags, data, pohmelfs_fill_super);
mnt);
} }
/* /*
@ -1958,7 +1957,7 @@ static void pohmelfs_kill_super(struct super_block *sb)
static struct file_system_type pohmel_fs_type = { static struct file_system_type pohmel_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "pohmel", .name = "pohmel",
.get_sb = pohmelfs_get_sb, .mount = pohmelfs_mount,
.kill_sb = pohmelfs_kill_super, .kill_sb = pohmelfs_kill_super,
}; };

View File

@ -793,16 +793,16 @@ smb_notify_change(struct dentry *dentry, struct iattr *attr)
return error; return error;
} }
static int smb_get_sb(struct file_system_type *fs_type, static struct dentry *smb_mount(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)
{ {
return get_sb_nodev(fs_type, flags, data, smb_fill_super, mnt); return mount_nodev(fs_type, flags, data, smb_fill_super);
} }
static struct file_system_type smb_fs_type = { static struct file_system_type smb_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "smbfs", .name = "smbfs",
.get_sb = smb_get_sb, .mount = smb_mount,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
.fs_flags = FS_BINARY_MOUNTDATA, .fs_flags = FS_BINARY_MOUNTDATA,
}; };

View File

@ -574,16 +574,16 @@ static void fs_remove_file (struct dentry *dentry)
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
static int usb_get_sb(struct file_system_type *fs_type, static struct dentry *usb_mount(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)
{ {
return get_sb_single(fs_type, flags, data, usbfs_fill_super, mnt); return mount_single(fs_type, flags, data, usbfs_fill_super);
} }
static struct file_system_type usb_fs_type = { static struct file_system_type usb_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "usbfs", .name = "usbfs",
.get_sb = usb_get_sb, .mount = usb_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

View File

@ -1176,9 +1176,9 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts)
/* "mount -t functionfs dev_name /dev/function" ends up here */ /* "mount -t functionfs dev_name /dev/function" ends up here */
static int static struct dentry *
ffs_fs_get_sb(struct file_system_type *t, int flags, ffs_fs_mount(struct file_system_type *t, int flags,
const char *dev_name, void *opts, struct vfsmount *mnt) const char *dev_name, void *opts)
{ {
struct ffs_sb_fill_data data = { struct ffs_sb_fill_data data = {
.perms = { .perms = {
@ -1194,14 +1194,14 @@ ffs_fs_get_sb(struct file_system_type *t, int flags,
ret = functionfs_check_dev_callback(dev_name); ret = functionfs_check_dev_callback(dev_name);
if (unlikely(ret < 0)) if (unlikely(ret < 0))
return ret; return ERR_PTR(ret);
ret = ffs_fs_parse_opts(&data, opts); ret = ffs_fs_parse_opts(&data, opts);
if (unlikely(ret < 0)) if (unlikely(ret < 0))
return ret; return ERR_PTR(ret);
data.dev_name = dev_name; data.dev_name = dev_name;
return get_sb_single(t, flags, &data, ffs_sb_fill, mnt); return mount_single(t, flags, &data, ffs_sb_fill);
} }
static void static void
@ -1220,7 +1220,7 @@ ffs_fs_kill_sb(struct super_block *sb)
static struct file_system_type ffs_fs_type = { static struct file_system_type ffs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "functionfs", .name = "functionfs",
.get_sb = ffs_fs_get_sb, .mount = ffs_fs_mount,
.kill_sb = ffs_fs_kill_sb, .kill_sb = ffs_fs_kill_sb,
}; };

View File

@ -2097,11 +2097,11 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
} }
/* "mount -t gadgetfs path /dev/gadget" ends up here */ /* "mount -t gadgetfs path /dev/gadget" ends up here */
static int static struct dentry *
gadgetfs_get_sb (struct file_system_type *t, int flags, gadgetfs_mount (struct file_system_type *t, int flags,
const char *path, void *opts, struct vfsmount *mnt) const char *path, void *opts)
{ {
return get_sb_single (t, flags, opts, gadgetfs_fill_super, mnt); return mount_single (t, flags, opts, gadgetfs_fill_super);
} }
static void static void
@ -2119,7 +2119,7 @@ gadgetfs_kill_sb (struct super_block *sb)
static struct file_system_type gadgetfs_type = { static struct file_system_type gadgetfs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = shortname, .name = shortname,
.get_sb = gadgetfs_get_sb, .mount = gadgetfs_mount,
.kill_sb = gadgetfs_kill_sb, .kill_sb = gadgetfs_kill_sb,
}; };

View File

@ -121,17 +121,17 @@ static int xenfs_fill_super(struct super_block *sb, void *data, int silent)
return rc; return rc;
} }
static int xenfs_get_sb(struct file_system_type *fs_type, static int xenfs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
return get_sb_single(fs_type, flags, data, xenfs_fill_super, mnt); return mount_single(fs_type, flags, data, xenfs_fill_super);
} }
static struct file_system_type xenfs_type = { static struct file_system_type xenfs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "xenfs", .name = "xenfs",
.get_sb = xenfs_get_sb, .mount = xenfs_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

View File

@ -68,7 +68,7 @@ static int v9fs_set_super(struct super_block *s, void *data)
* v9fs_fill_super - populate superblock with info * v9fs_fill_super - populate superblock with info
* @sb: superblock * @sb: superblock
* @v9ses: session information * @v9ses: session information
* @flags: flags propagated from v9fs_get_sb() * @flags: flags propagated from v9fs_mount()
* *
*/ */
@ -99,18 +99,16 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
} }
/** /**
* v9fs_get_sb - mount a superblock * v9fs_mount - mount a superblock
* @fs_type: file system type * @fs_type: file system type
* @flags: mount flags * @flags: mount flags
* @dev_name: device name that was mounted * @dev_name: device name that was mounted
* @data: mount options * @data: mount options
* @mnt: mountpoint record to be instantiated
* *
*/ */
static int v9fs_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, const char *dev_name, void *data)
struct vfsmount *mnt)
{ {
struct super_block *sb = NULL; struct super_block *sb = NULL;
struct inode *inode = NULL; struct inode *inode = NULL;
@ -124,7 +122,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL); v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
if (!v9ses) if (!v9ses)
return -ENOMEM; return ERR_PTR(-ENOMEM);
fid = v9fs_session_init(v9ses, dev_name, data); fid = v9fs_session_init(v9ses, dev_name, data);
if (IS_ERR(fid)) { if (IS_ERR(fid)) {
@ -186,15 +184,15 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
v9fs_fid_add(root, fid); v9fs_fid_add(root, fid);
P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n");
simple_set_mnt(mnt, sb); return dget(sb->s_root);
return 0;
clunk_fid: clunk_fid:
p9_client_clunk(fid); p9_client_clunk(fid);
close_session: close_session:
v9fs_session_close(v9ses); v9fs_session_close(v9ses);
kfree(v9ses); kfree(v9ses);
return retval; return ERR_PTR(retval);
release_sb: release_sb:
/* /*
* we will do the session_close and root dentry release * we will do the session_close and root dentry release
@ -204,7 +202,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
*/ */
p9_client_clunk(fid); p9_client_clunk(fid);
deactivate_locked_super(sb); deactivate_locked_super(sb);
return retval; return ERR_PTR(retval);
} }
/** /**
@ -300,7 +298,7 @@ static const struct super_operations v9fs_super_ops_dotl = {
struct file_system_type v9fs_fs_type = { struct file_system_type v9fs_fs_type = {
.name = "9p", .name = "9p",
.get_sb = v9fs_get_sb, .mount = v9fs_mount,
.kill_sb = v9fs_kill_super, .kill_sb = v9fs_kill_super,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fs_flags = FS_RENAME_DOES_D_MOVE, .fs_flags = FS_RENAME_DOES_D_MOVE,

View File

@ -490,17 +490,16 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
return -EINVAL; return -EINVAL;
} }
static int adfs_get_sb(struct file_system_type *fs_type, static struct dentry *adfs_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, adfs_fill_super, return mount_bdev(fs_type, flags, dev_name, data, adfs_fill_super);
mnt);
} }
static struct file_system_type adfs_fs_type = { static struct file_system_type adfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "adfs", .name = "adfs",
.get_sb = adfs_get_sb, .mount = adfs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -573,17 +573,16 @@ affs_statfs(struct dentry *dentry, struct kstatfs *buf)
return 0; return 0;
} }
static int affs_get_sb(struct file_system_type *fs_type, static struct dentry *affs_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, affs_fill_super, return mount_bdev(fs_type, flags, dev_name, data, affs_fill_super);
mnt);
} }
static struct file_system_type affs_fs_type = { static struct file_system_type affs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "affs", .name = "affs",
.get_sb = affs_get_sb, .mount = affs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -29,9 +29,8 @@
#define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */ #define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */
static void afs_i_init_once(void *foo); static void afs_i_init_once(void *foo);
static int afs_get_sb(struct file_system_type *fs_type, static struct dentry *afs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name, void *data);
void *data, struct vfsmount *mnt);
static struct inode *afs_alloc_inode(struct super_block *sb); static struct inode *afs_alloc_inode(struct super_block *sb);
static void afs_put_super(struct super_block *sb); static void afs_put_super(struct super_block *sb);
static void afs_destroy_inode(struct inode *inode); static void afs_destroy_inode(struct inode *inode);
@ -40,7 +39,7 @@ static int afs_statfs(struct dentry *dentry, struct kstatfs *buf);
struct file_system_type afs_fs_type = { struct file_system_type afs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "afs", .name = "afs",
.get_sb = afs_get_sb, .mount = afs_mount,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
.fs_flags = 0, .fs_flags = 0,
}; };
@ -359,11 +358,8 @@ static int afs_fill_super(struct super_block *sb, void *data)
/* /*
* get an AFS superblock * get an AFS superblock
*/ */
static int afs_get_sb(struct file_system_type *fs_type, static struct dentry *afs_mount(struct file_system_type *fs_type,
int flags, int flags, const char *dev_name, void *options)
const char *dev_name,
void *options,
struct vfsmount *mnt)
{ {
struct afs_mount_params params; struct afs_mount_params params;
struct super_block *sb; struct super_block *sb;
@ -427,12 +423,11 @@ static int afs_get_sb(struct file_system_type *fs_type,
ASSERTCMP(sb->s_flags, &, MS_ACTIVE); ASSERTCMP(sb->s_flags, &, MS_ACTIVE);
} }
simple_set_mnt(mnt, sb);
afs_put_volume(params.volume); afs_put_volume(params.volume);
afs_put_cell(params.cell); afs_put_cell(params.cell);
kfree(new_opts); kfree(new_opts);
_leave(" = 0 [%p]", sb); _leave(" = 0 [%p]", sb);
return 0; return dget(sb->s_root);
error: error:
afs_put_volume(params.volume); afs_put_volume(params.volume);
@ -440,7 +435,7 @@ static int afs_get_sb(struct file_system_type *fs_type,
key_put(params.key); key_put(params.key);
kfree(new_opts); kfree(new_opts);
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ERR_PTR(ret);
} }
/* /*

View File

@ -26,12 +26,10 @@ static struct vfsmount *anon_inode_mnt __read_mostly;
static struct inode *anon_inode_inode; static struct inode *anon_inode_inode;
static const struct file_operations anon_inode_fops; static const struct file_operations anon_inode_fops;
static int anon_inodefs_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *anon_inodefs_mount(struct file_system_type *fs_type,
const char *dev_name, void *data, int flags, const char *dev_name, void *data)
struct vfsmount *mnt)
{ {
return get_sb_pseudo(fs_type, "anon_inode:", NULL, ANON_INODE_FS_MAGIC, return mount_pseudo(fs_type, "anon_inode:", NULL, ANON_INODE_FS_MAGIC);
mnt);
} }
/* /*
@ -45,7 +43,7 @@ static char *anon_inodefs_dname(struct dentry *dentry, char *buffer, int buflen)
static struct file_system_type anon_inode_fs_type = { static struct file_system_type anon_inode_fs_type = {
.name = "anon_inodefs", .name = "anon_inodefs",
.get_sb = anon_inodefs_get_sb, .mount = anon_inodefs_mount,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
}; };
static const struct dentry_operations anon_inodefs_dentry_operations = { static const struct dentry_operations anon_inodefs_dentry_operations = {

View File

@ -14,16 +14,16 @@
#include <linux/init.h> #include <linux/init.h>
#include "autofs_i.h" #include "autofs_i.h"
static int autofs_get_sb(struct file_system_type *fs_type, static struct dentry *autofs_mount(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)
{ {
return get_sb_nodev(fs_type, flags, data, autofs4_fill_super, mnt); return mount_nodev(fs_type, flags, data, autofs4_fill_super);
} }
static struct file_system_type autofs_fs_type = { static struct file_system_type autofs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "autofs", .name = "autofs",
.get_sb = autofs_get_sb, .mount = autofs_mount,
.kill_sb = autofs4_kill_sb, .kill_sb = autofs4_kill_sb,
}; };

View File

@ -913,18 +913,17 @@ befs_statfs(struct dentry *dentry, struct kstatfs *buf)
return 0; return 0;
} }
static int static struct dentry *
befs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, befs_mount(struct file_system_type *fs_type, int flags, const char *dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, befs_fill_super, return mount_bdev(fs_type, flags, dev_name, data, befs_fill_super);
mnt);
} }
static struct file_system_type befs_fs_type = { static struct file_system_type befs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "befs", .name = "befs",
.get_sb = befs_get_sb, .mount = befs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -450,16 +450,16 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
return ret; return ret;
} }
static int bfs_get_sb(struct file_system_type *fs_type, static struct dentry *bfs_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, bfs_fill_super, mnt); return mount_bdev(fs_type, flags, dev_name, data, bfs_fill_super);
} }
static struct file_system_type bfs_fs_type = { static struct file_system_type bfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "bfs", .name = "bfs",
.get_sb = bfs_get_sb, .mount = bfs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -706,10 +706,10 @@ static int bm_fill_super(struct super_block * sb, void * data, int silent)
return err; return err;
} }
static int bm_get_sb(struct file_system_type *fs_type, static struct dentry *bm_mount(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)
{ {
return get_sb_single(fs_type, flags, data, bm_fill_super, mnt); return mount_single(fs_type, flags, data, bm_fill_super);
} }
static struct linux_binfmt misc_format = { static struct linux_binfmt misc_format = {
@ -720,7 +720,7 @@ static struct linux_binfmt misc_format = {
static struct file_system_type bm_fs_type = { static struct file_system_type bm_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "binfmt_misc", .name = "binfmt_misc",
.get_sb = bm_get_sb, .mount = bm_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

View File

@ -464,15 +464,15 @@ static const struct super_operations bdev_sops = {
.evict_inode = bdev_evict_inode, .evict_inode = bdev_evict_inode,
}; };
static int bd_get_sb(struct file_system_type *fs_type, static struct dentry *bd_mount(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)
{ {
return get_sb_pseudo(fs_type, "bdev:", &bdev_sops, 0x62646576, mnt); return mount_pseudo(fs_type, "bdev:", &bdev_sops, 0x62646576);
} }
static struct file_system_type bd_type = { static struct file_system_type bd_type = {
.name = "bdev", .name = "bdev",
.get_sb = bd_get_sb, .mount = bd_mount,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
}; };

View File

@ -560,8 +560,8 @@ static int btrfs_test_super(struct super_block *s, void *data)
* Note: This is based on get_sb_bdev from fs/super.c with a few additions * Note: This is based on get_sb_bdev from fs/super.c with a few additions
* for multiple device setup. Make sure to keep it in sync. * for multiple device setup. Make sure to keep it in sync.
*/ */
static int btrfs_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, struct vfsmount *mnt) const char *dev_name, void *data)
{ {
struct block_device *bdev = NULL; struct block_device *bdev = NULL;
struct super_block *s; struct super_block *s;
@ -580,7 +580,7 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
&subvol_name, &subvol_objectid, &subvol_name, &subvol_objectid,
&fs_devices); &fs_devices);
if (error) if (error)
return error; return ERR_PTR(error);
error = btrfs_scan_one_device(dev_name, mode, fs_type, &fs_devices); error = btrfs_scan_one_device(dev_name, mode, fs_type, &fs_devices);
if (error) if (error)
@ -656,11 +656,8 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
root = new_root; root = new_root;
} }
mnt->mnt_sb = s;
mnt->mnt_root = root;
kfree(subvol_name); kfree(subvol_name);
return 0; return root;
error_s: error_s:
error = PTR_ERR(s); error = PTR_ERR(s);
@ -669,7 +666,7 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
error_free_subvol_name: error_free_subvol_name:
kfree(subvol_name); kfree(subvol_name);
error: error:
return error; return ERR_PTR(error);
} }
static int btrfs_remount(struct super_block *sb, int *flags, char *data) static int btrfs_remount(struct super_block *sb, int *flags, char *data)
@ -746,7 +743,7 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
static struct file_system_type btrfs_fs_type = { static struct file_system_type btrfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "btrfs", .name = "btrfs",
.get_sb = btrfs_get_sb, .mount = btrfs_mount,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -635,7 +635,7 @@ static struct dentry *open_root_dentry(struct ceph_fs_client *fsc,
/* /*
* mount: join the ceph cluster, and open root directory. * mount: join the ceph cluster, and open root directory.
*/ */
static int ceph_mount(struct ceph_fs_client *fsc, struct vfsmount *mnt, static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
const char *path) const char *path)
{ {
int err; int err;
@ -678,16 +678,14 @@ static int ceph_mount(struct ceph_fs_client *fsc, struct vfsmount *mnt,
} }
} }
mnt->mnt_root = root;
mnt->mnt_sb = fsc->sb;
fsc->mount_state = CEPH_MOUNT_MOUNTED; fsc->mount_state = CEPH_MOUNT_MOUNTED;
dout("mount success\n"); dout("mount success\n");
err = 0; mutex_unlock(&fsc->client->mount_mutex);
return root;
out: out:
mutex_unlock(&fsc->client->mount_mutex); mutex_unlock(&fsc->client->mount_mutex);
return err; return ERR_PTR(err);
fail: fail:
if (first) { if (first) {
@ -777,41 +775,45 @@ static int ceph_register_bdi(struct super_block *sb,
return err; return err;
} }
static int ceph_get_sb(struct file_system_type *fs_type, static struct dentry *ceph_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data, int flags, const char *dev_name, void *data)
struct vfsmount *mnt)
{ {
struct super_block *sb; struct super_block *sb;
struct ceph_fs_client *fsc; struct ceph_fs_client *fsc;
struct dentry *res;
int err; int err;
int (*compare_super)(struct super_block *, void *) = ceph_compare_super; int (*compare_super)(struct super_block *, void *) = ceph_compare_super;
const char *path = NULL; const char *path = NULL;
struct ceph_mount_options *fsopt = NULL; struct ceph_mount_options *fsopt = NULL;
struct ceph_options *opt = NULL; struct ceph_options *opt = NULL;
dout("ceph_get_sb\n"); dout("ceph_mount\n");
err = parse_mount_options(&fsopt, &opt, flags, data, dev_name, &path); err = parse_mount_options(&fsopt, &opt, flags, data, dev_name, &path);
if (err < 0) if (err < 0) {
res = ERR_PTR(err);
goto out_final; goto out_final;
}
/* create client (which we may/may not use) */ /* create client (which we may/may not use) */
fsc = create_fs_client(fsopt, opt); fsc = create_fs_client(fsopt, opt);
if (IS_ERR(fsc)) { if (IS_ERR(fsc)) {
err = PTR_ERR(fsc); res = ERR_CAST(fsc);
kfree(fsopt); kfree(fsopt);
kfree(opt); kfree(opt);
goto out_final; goto out_final;
} }
err = ceph_mdsc_init(fsc); err = ceph_mdsc_init(fsc);
if (err < 0) if (err < 0) {
res = ERR_PTR(err);
goto out; goto out;
}
if (ceph_test_opt(fsc->client, NOSHARE)) if (ceph_test_opt(fsc->client, NOSHARE))
compare_super = NULL; compare_super = NULL;
sb = sget(fs_type, compare_super, ceph_set_super, fsc); sb = sget(fs_type, compare_super, ceph_set_super, fsc);
if (IS_ERR(sb)) { if (IS_ERR(sb)) {
err = PTR_ERR(sb); res = ERR_CAST(sb);
goto out; goto out;
} }
@ -823,16 +825,18 @@ static int ceph_get_sb(struct file_system_type *fs_type,
} else { } else {
dout("get_sb using new client %p\n", fsc); dout("get_sb using new client %p\n", fsc);
err = ceph_register_bdi(sb, fsc); err = ceph_register_bdi(sb, fsc);
if (err < 0) if (err < 0) {
res = ERR_PTR(err);
goto out_splat; goto out_splat;
}
} }
err = ceph_mount(fsc, mnt, path); res = ceph_real_mount(fsc, path);
if (err < 0) if (IS_ERR(res))
goto out_splat; goto out_splat;
dout("root %p inode %p ino %llx.%llx\n", mnt->mnt_root, dout("root %p inode %p ino %llx.%llx\n", res,
mnt->mnt_root->d_inode, ceph_vinop(mnt->mnt_root->d_inode)); res->d_inode, ceph_vinop(res->d_inode));
return 0; return res;
out_splat: out_splat:
ceph_mdsc_close_sessions(fsc->mdsc); ceph_mdsc_close_sessions(fsc->mdsc);
@ -843,8 +847,8 @@ static int ceph_get_sb(struct file_system_type *fs_type,
ceph_mdsc_destroy(fsc); ceph_mdsc_destroy(fsc);
destroy_fs_client(fsc); destroy_fs_client(fsc);
out_final: out_final:
dout("ceph_get_sb fail %d\n", err); dout("ceph_mount fail %ld\n", PTR_ERR(res));
return err; return res;
} }
static void ceph_kill_sb(struct super_block *s) static void ceph_kill_sb(struct super_block *s)
@ -860,7 +864,7 @@ static void ceph_kill_sb(struct super_block *s)
static struct file_system_type ceph_fs_type = { static struct file_system_type ceph_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ceph", .name = "ceph",
.get_sb = ceph_get_sb, .mount = ceph_mount,
.kill_sb = ceph_kill_sb, .kill_sb = ceph_kill_sb,
.fs_flags = FS_RENAME_DOES_D_MOVE, .fs_flags = FS_RENAME_DOES_D_MOVE,
}; };

View File

@ -545,9 +545,9 @@ static const struct super_operations cifs_super_ops = {
#endif #endif
}; };
static int static struct dentry *
cifs_get_sb(struct file_system_type *fs_type, cifs_do_mount(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)
{ {
int rc; int rc;
struct super_block *sb; struct super_block *sb;
@ -557,18 +557,17 @@ cifs_get_sb(struct file_system_type *fs_type,
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))
return PTR_ERR(sb); return ERR_CAST(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);
return rc; return ERR_PTR(rc);
} }
sb->s_flags |= MS_ACTIVE; sb->s_flags |= MS_ACTIVE;
simple_set_mnt(mnt, sb); return dget(sb->s_root);
return 0;
} }
static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
@ -634,7 +633,7 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
struct file_system_type cifs_fs_type = { struct file_system_type cifs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "cifs", .name = "cifs",
.get_sb = cifs_get_sb, .mount = cifs_do_mount,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
/* .fs_flags */ /* .fs_flags */
}; };

View File

@ -306,16 +306,16 @@ static int coda_statfs(struct dentry *dentry, struct kstatfs *buf)
/* init_coda: used by filesystems.c to register coda */ /* init_coda: used by filesystems.c to register coda */
static int coda_get_sb(struct file_system_type *fs_type, static struct dentry *coda_mount(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)
{ {
return get_sb_nodev(fs_type, flags, data, coda_fill_super, mnt); return mount_nodev(fs_type, flags, data, coda_fill_super);
} }
struct file_system_type coda_fs_type = { struct file_system_type coda_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "coda", .name = "coda",
.get_sb = coda_get_sb, .mount = coda_mount,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
.fs_flags = FS_BINARY_MOUNTDATA, .fs_flags = FS_BINARY_MOUNTDATA,
}; };

View File

@ -104,16 +104,16 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent)
return 0; return 0;
} }
static int configfs_get_sb(struct file_system_type *fs_type, static struct dentry *configfs_do_mount(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)
{ {
return get_sb_single(fs_type, flags, data, configfs_fill_super, mnt); return mount_single(fs_type, flags, data, configfs_fill_super);
} }
static struct file_system_type configfs_fs_type = { static struct file_system_type configfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "configfs", .name = "configfs",
.get_sb = configfs_get_sb, .mount = configfs_do_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

View File

@ -533,17 +533,16 @@ static const struct super_operations cramfs_ops = {
.statfs = cramfs_statfs, .statfs = cramfs_statfs,
}; };
static int cramfs_get_sb(struct file_system_type *fs_type, static struct dentry *cramfs_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, cramfs_fill_super, return mount_bdev(fs_type, flags, dev_name, data, cramfs_fill_super);
mnt);
} }
static struct file_system_type cramfs_fs_type = { static struct file_system_type cramfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "cramfs", .name = "cramfs",
.get_sb = cramfs_get_sb, .mount = cramfs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -135,17 +135,17 @@ static int debug_fill_super(struct super_block *sb, void *data, int silent)
return simple_fill_super(sb, DEBUGFS_MAGIC, debug_files); return simple_fill_super(sb, DEBUGFS_MAGIC, debug_files);
} }
static int debug_get_sb(struct file_system_type *fs_type, static struct dentry *debug_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
return get_sb_single(fs_type, flags, data, debug_fill_super, mnt); return mount_single(fs_type, flags, data, debug_fill_super);
} }
static struct file_system_type debug_fs_type = { static struct file_system_type debug_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "debugfs", .name = "debugfs",
.get_sb = debug_get_sb, .mount = debug_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

View File

@ -331,7 +331,7 @@ static int compare_init_pts_sb(struct super_block *s, void *p)
} }
/* /*
* devpts_get_sb() * devpts_mount()
* *
* If the '-o newinstance' mount option was specified, mount a new * If the '-o newinstance' mount option was specified, mount a new
* (private) instance of devpts. PTYs created in this instance are * (private) instance of devpts. PTYs created in this instance are
@ -345,20 +345,20 @@ static int compare_init_pts_sb(struct super_block *s, void *p)
* semantics in devpts while preserving backward compatibility of the * semantics in devpts while preserving backward compatibility of the
* current 'single-namespace' semantics. i.e all mounts of devpts * current 'single-namespace' semantics. i.e all mounts of devpts
* without the 'newinstance' mount option should bind to the initial * without the 'newinstance' mount option should bind to the initial
* kernel mount, like get_sb_single(). * kernel mount, like mount_single().
* *
* Mounts with 'newinstance' option create a new, private namespace. * Mounts with 'newinstance' option create a new, private namespace.
* *
* NOTE: * NOTE:
* *
* For single-mount semantics, devpts cannot use get_sb_single(), * For single-mount semantics, devpts cannot use mount_single(),
* because get_sb_single()/sget() find and use the super-block from * because mount_single()/sget() find and use the super-block from
* the most recent mount of devpts. But that recent mount may be a * the most recent mount of devpts. But that recent mount may be a
* 'newinstance' mount and get_sb_single() would pick the newinstance * 'newinstance' mount and mount_single() would pick the newinstance
* super-block instead of the initial super-block. * super-block instead of the initial super-block.
*/ */
static int devpts_get_sb(struct file_system_type *fs_type, static struct dentry *devpts_mount(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)
{ {
int error; int error;
struct pts_mount_opts opts; struct pts_mount_opts opts;
@ -366,7 +366,7 @@ static int devpts_get_sb(struct file_system_type *fs_type,
error = parse_mount_options(data, PARSE_MOUNT, &opts); error = parse_mount_options(data, PARSE_MOUNT, &opts);
if (error) if (error)
return error; return ERR_PTR(error);
if (opts.newinstance) if (opts.newinstance)
s = sget(fs_type, NULL, set_anon_super, NULL); s = sget(fs_type, NULL, set_anon_super, NULL);
@ -374,7 +374,7 @@ static int devpts_get_sb(struct file_system_type *fs_type,
s = sget(fs_type, compare_init_pts_sb, set_anon_super, NULL); s = sget(fs_type, compare_init_pts_sb, set_anon_super, NULL);
if (IS_ERR(s)) if (IS_ERR(s))
return PTR_ERR(s); return ERR_CAST(s);
if (!s->s_root) { if (!s->s_root) {
s->s_flags = flags; s->s_flags = flags;
@ -390,13 +390,11 @@ static int devpts_get_sb(struct file_system_type *fs_type,
if (error) if (error)
goto out_undo_sget; goto out_undo_sget;
simple_set_mnt(mnt, s); return dget(s->s_root);
return 0;
out_undo_sget: out_undo_sget:
deactivate_locked_super(s); deactivate_locked_super(s);
return error; return ERR_PTR(error);
} }
#else #else
@ -404,10 +402,10 @@ static int devpts_get_sb(struct file_system_type *fs_type,
* This supports only the legacy single-instance semantics (no * This supports only the legacy single-instance semantics (no
* multiple-instance semantics) * multiple-instance semantics)
*/ */
static int devpts_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *devpts_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, struct vfsmount *mnt) const char *dev_name, void *data)
{ {
return get_sb_single(fs_type, flags, data, devpts_fill_super, mnt); return mount_single(fs_type, flags, data, devpts_fill_super);
} }
#endif #endif
@ -421,7 +419,7 @@ static void devpts_kill_sb(struct super_block *sb)
static struct file_system_type devpts_fs_type = { static struct file_system_type devpts_fs_type = {
.name = "devpts", .name = "devpts",
.get_sb = devpts_get_sb, .mount = devpts_mount,
.kill_sb = devpts_kill_sb, .kill_sb = devpts_kill_sb,
}; };

View File

@ -540,9 +540,8 @@ static int ecryptfs_read_super(struct super_block *sb, const char *dev_name)
* ecryptfs_interpose to perform most of the linking * ecryptfs_interpose to perform most of the linking
* ecryptfs_interpose(): links the lower filesystem into ecryptfs (inode.c) * ecryptfs_interpose(): links the lower filesystem into ecryptfs (inode.c)
*/ */
static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *raw_data, const char *dev_name, void *raw_data)
struct vfsmount *mnt)
{ {
struct super_block *s; struct super_block *s;
struct ecryptfs_sb_info *sbi; struct ecryptfs_sb_info *sbi;
@ -607,8 +606,7 @@ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags,
err = "Reading sb failed"; err = "Reading sb failed";
goto out; goto out;
} }
simple_set_mnt(mnt, s); return dget(s->s_root);
return 0;
out: out:
if (sbi) { if (sbi) {
@ -616,7 +614,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);
return rc; return ERR_PTR(rc);
} }
/** /**
@ -639,7 +637,7 @@ static void ecryptfs_kill_block_super(struct super_block *sb)
static struct file_system_type ecryptfs_fs_type = { static struct file_system_type ecryptfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ecryptfs", .name = "ecryptfs",
.get_sb = ecryptfs_get_sb, .mount = ecryptfs_mount,
.kill_sb = ecryptfs_kill_block_super, .kill_sb = ecryptfs_kill_block_super,
.fs_flags = 0 .fs_flags = 0
}; };

View File

@ -20,16 +20,16 @@
static int efs_statfs(struct dentry *dentry, struct kstatfs *buf); static int efs_statfs(struct dentry *dentry, struct kstatfs *buf);
static int efs_fill_super(struct super_block *s, void *d, int silent); static int efs_fill_super(struct super_block *s, void *d, int silent);
static int efs_get_sb(struct file_system_type *fs_type, static struct dentry *efs_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, efs_fill_super, mnt); return mount_bdev(fs_type, flags, dev_name, data, efs_fill_super);
} }
static struct file_system_type efs_fs_type = { static struct file_system_type efs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "efs", .name = "efs",
.get_sb = efs_get_sb, .mount = efs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -659,19 +659,19 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
/* /*
* Set up the superblock (calls exofs_fill_super eventually) * Set up the superblock (calls exofs_fill_super eventually)
*/ */
static int exofs_get_sb(struct file_system_type *type, static struct dentry *exofs_mount(struct file_system_type *type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
struct exofs_mountopt opts; struct exofs_mountopt opts;
int ret; int ret;
ret = parse_options(data, &opts); ret = parse_options(data, &opts);
if (ret) if (ret)
return ret; return ERR_PTR(ret);
opts.dev_name = dev_name; opts.dev_name = dev_name;
return get_sb_nodev(type, flags, &opts, exofs_fill_super, mnt); return mount_nodev(type, flags, &opts, exofs_fill_super);
} }
/* /*
@ -809,7 +809,7 @@ static const struct export_operations exofs_export_ops = {
static struct file_system_type exofs_type = { static struct file_system_type exofs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "exofs", .name = "exofs",
.get_sb = exofs_get_sb, .mount = exofs_mount,
.kill_sb = generic_shutdown_super, .kill_sb = generic_shutdown_super,
}; };

View File

@ -1356,10 +1356,10 @@ static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf)
return 0; return 0;
} }
static int ext2_get_sb(struct file_system_type *fs_type, static struct dentry *ext2_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, ext2_fill_super, mnt); return mount_bdev(fs_type, flags, dev_name, data, ext2_fill_super);
} }
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
@ -1473,7 +1473,7 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type,
static struct file_system_type ext2_fs_type = { static struct file_system_type ext2_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ext2", .name = "ext2",
.get_sb = ext2_get_sb, .mount = ext2_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -3020,16 +3020,16 @@ static ssize_t ext3_quota_write(struct super_block *sb, int type,
#endif #endif
static int ext3_get_sb(struct file_system_type *fs_type, static struct dentry *ext3_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, ext3_fill_super, mnt); return mount_bdev(fs_type, flags, dev_name, data, ext3_fill_super);
} }
static struct file_system_type ext3_fs_type = { static struct file_system_type ext3_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ext3", .name = "ext3",
.get_sb = ext3_get_sb, .mount = ext3_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -73,8 +73,8 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf);
static int ext4_unfreeze(struct super_block *sb); static int ext4_unfreeze(struct super_block *sb);
static void ext4_write_super(struct super_block *sb); static void ext4_write_super(struct super_block *sb);
static int ext4_freeze(struct super_block *sb); static int ext4_freeze(struct super_block *sb);
static int ext4_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *ext4_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, struct vfsmount *mnt); const char *dev_name, void *data);
static void ext4_destroy_lazyinit_thread(void); static void ext4_destroy_lazyinit_thread(void);
static void ext4_unregister_li_request(struct super_block *sb); static void ext4_unregister_li_request(struct super_block *sb);
@ -82,7 +82,7 @@ static void ext4_unregister_li_request(struct super_block *sb);
static struct file_system_type ext3_fs_type = { static struct file_system_type ext3_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ext3", .name = "ext3",
.get_sb = ext4_get_sb, .mount = ext4_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };
@ -4667,17 +4667,17 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
#endif #endif
static int ext4_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *ext4_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, struct vfsmount *mnt) const char *dev_name, void *data)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super,mnt); return mount_bdev(fs_type, flags, dev_name, data, ext4_fill_super);
} }
#if !defined(CONFIG_EXT2_FS) && !defined(CONFIG_EXT2_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT23) #if !defined(CONFIG_EXT2_FS) && !defined(CONFIG_EXT2_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT23)
static struct file_system_type ext2_fs_type = { static struct file_system_type ext2_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ext2", .name = "ext2",
.get_sb = ext4_get_sb, .mount = ext4_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };
@ -4722,7 +4722,7 @@ static inline void unregister_as_ext3(void) { }
static struct file_system_type ext4_fs_type = { static struct file_system_type ext4_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ext4", .name = "ext4",
.get_sb = ext4_get_sb, .mount = ext4_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -675,18 +675,17 @@ static int msdos_fill_super(struct super_block *sb, void *data, int silent)
return 0; return 0;
} }
static int msdos_get_sb(struct file_system_type *fs_type, static struct dentry *msdos_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, msdos_fill_super, return mount_bdev(fs_type, flags, dev_name, data, msdos_fill_super);
mnt);
} }
static struct file_system_type msdos_fs_type = { static struct file_system_type msdos_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "msdos", .name = "msdos",
.get_sb = msdos_get_sb, .mount = msdos_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -1071,18 +1071,17 @@ static int vfat_fill_super(struct super_block *sb, void *data, int silent)
return 0; return 0;
} }
static int vfat_get_sb(struct file_system_type *fs_type, static struct dentry *vfat_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, vfat_fill_super, return mount_bdev(fs_type, flags, dev_name, data, vfat_fill_super);
mnt);
} }
static struct file_system_type vfat_fs_type = { static struct file_system_type vfat_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "vfat", .name = "vfat",
.get_sb = vfat_get_sb, .mount = vfat_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -246,17 +246,16 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
/* /*
* The usual module blurb. * The usual module blurb.
*/ */
static int vxfs_get_sb(struct file_system_type *fs_type, static struct dentry *vxfs_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, vxfs_fill_super, return mount_bdev(fs_type, flags, dev_name, data, vxfs_fill_super);
mnt);
} }
static struct file_system_type vxfs_fs_type = { static struct file_system_type vxfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "vxfs", .name = "vxfs",
.get_sb = vxfs_get_sb, .mount = vxfs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -322,12 +322,10 @@ static int fuse_ctl_fill_super(struct super_block *sb, void *data, int silent)
return 0; return 0;
} }
static int fuse_ctl_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *fuse_ctl_mount(struct file_system_type *fs_type,
const char *dev_name, void *raw_data, int flags, const char *dev_name, void *raw_data)
struct vfsmount *mnt)
{ {
return get_sb_single(fs_type, flags, raw_data, return mount_single(fs_type, flags, raw_data, fuse_ctl_fill_super);
fuse_ctl_fill_super, mnt);
} }
static void fuse_ctl_kill_sb(struct super_block *sb) static void fuse_ctl_kill_sb(struct super_block *sb)
@ -346,7 +344,7 @@ static void fuse_ctl_kill_sb(struct super_block *sb)
static struct file_system_type fuse_ctl_fs_type = { static struct file_system_type fuse_ctl_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "fusectl", .name = "fusectl",
.get_sb = fuse_ctl_get_sb, .mount = fuse_ctl_mount,
.kill_sb = fuse_ctl_kill_sb, .kill_sb = fuse_ctl_kill_sb,
}; };

View File

@ -1041,11 +1041,11 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
return err; return err;
} }
static int fuse_get_sb(struct file_system_type *fs_type, static struct dentry *fuse_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *raw_data, struct vfsmount *mnt) void *raw_data)
{ {
return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super, mnt); return mount_nodev(fs_type, flags, raw_data, fuse_fill_super);
} }
static void fuse_kill_sb_anon(struct super_block *sb) static void fuse_kill_sb_anon(struct super_block *sb)
@ -1065,17 +1065,16 @@ static struct file_system_type fuse_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "fuse", .name = "fuse",
.fs_flags = FS_HAS_SUBTYPE, .fs_flags = FS_HAS_SUBTYPE,
.get_sb = fuse_get_sb, .mount = fuse_mount,
.kill_sb = fuse_kill_sb_anon, .kill_sb = fuse_kill_sb_anon,
}; };
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
static int fuse_get_sb_blk(struct file_system_type *fs_type, static struct dentry *fuse_mount_blk(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *raw_data, struct vfsmount *mnt) void *raw_data)
{ {
return get_sb_bdev(fs_type, flags, dev_name, raw_data, fuse_fill_super, return mount_bdev(fs_type, flags, dev_name, raw_data, fuse_fill_super);
mnt);
} }
static void fuse_kill_sb_blk(struct super_block *sb) static void fuse_kill_sb_blk(struct super_block *sb)
@ -1094,7 +1093,7 @@ static void fuse_kill_sb_blk(struct super_block *sb)
static struct file_system_type fuseblk_fs_type = { static struct file_system_type fuseblk_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "fuseblk", .name = "fuseblk",
.get_sb = fuse_get_sb_blk, .mount = fuse_mount_blk,
.kill_sb = fuse_kill_sb_blk, .kill_sb = fuse_kill_sb_blk,
.fs_flags = FS_REQUIRES_DEV | FS_HAS_SUBTYPE, .fs_flags = FS_REQUIRES_DEV | FS_HAS_SUBTYPE,
}; };

View File

@ -1250,12 +1250,11 @@ static int test_gfs2_super(struct super_block *s, void *ptr)
} }
/** /**
* gfs2_get_sb - Get the GFS2 superblock * gfs2_mount - Get the GFS2 superblock
* @fs_type: The GFS2 filesystem type * @fs_type: The GFS2 filesystem type
* @flags: Mount flags * @flags: Mount flags
* @dev_name: The name of the device * @dev_name: The name of the device
* @data: The mount arguments * @data: The mount arguments
* @mnt: The vfsmnt for this mount
* *
* Q. Why not use get_sb_bdev() ? * Q. Why not use get_sb_bdev() ?
* A. We need to select one of two root directories to mount, independent * A. We need to select one of two root directories to mount, independent
@ -1264,8 +1263,8 @@ static int test_gfs2_super(struct super_block *s, void *ptr)
* Returns: 0 or -ve on error * Returns: 0 or -ve on error
*/ */
static int gfs2_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, struct vfsmount *mnt) const char *dev_name, void *data)
{ {
struct block_device *bdev; struct block_device *bdev;
struct super_block *s; struct super_block *s;
@ -1279,7 +1278,7 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
bdev = open_bdev_exclusive(dev_name, mode, fs_type); bdev = open_bdev_exclusive(dev_name, mode, fs_type);
if (IS_ERR(bdev)) if (IS_ERR(bdev))
return PTR_ERR(bdev); return ERR_CAST(bdev);
/* /*
* once the super is inserted into the list by sget, s_umount * once the super is inserted into the list by sget, s_umount
@ -1298,6 +1297,9 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
if (IS_ERR(s)) if (IS_ERR(s))
goto error_bdev; goto error_bdev;
if (s->s_root)
close_bdev_exclusive(bdev, mode);
memset(&args, 0, sizeof(args)); memset(&args, 0, sizeof(args));
args.ar_quota = GFS2_QUOTA_DEFAULT; args.ar_quota = GFS2_QUOTA_DEFAULT;
args.ar_data = GFS2_DATA_DEFAULT; args.ar_data = GFS2_DATA_DEFAULT;
@ -1309,17 +1311,13 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
error = gfs2_mount_args(&args, data); error = gfs2_mount_args(&args, data);
if (error) { if (error) {
printk(KERN_WARNING "GFS2: can't parse mount arguments\n"); printk(KERN_WARNING "GFS2: can't parse mount arguments\n");
if (s->s_root) goto error_super;
goto error_super;
deactivate_locked_super(s);
return error;
} }
if (s->s_root) { if (s->s_root) {
error = -EBUSY; error = -EBUSY;
if ((flags ^ s->s_flags) & MS_RDONLY) if ((flags ^ s->s_flags) & MS_RDONLY)
goto error_super; goto error_super;
close_bdev_exclusive(bdev, mode);
} else { } else {
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
@ -1328,27 +1326,24 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
sb_set_blocksize(s, block_size(bdev)); sb_set_blocksize(s, block_size(bdev));
error = fill_super(s, &args, flags & MS_SILENT ? 1 : 0); error = fill_super(s, &args, flags & MS_SILENT ? 1 : 0);
if (error) { if (error)
deactivate_locked_super(s); goto error_super;
return error;
}
s->s_flags |= MS_ACTIVE; s->s_flags |= MS_ACTIVE;
bdev->bd_super = s; bdev->bd_super = s;
} }
sdp = s->s_fs_info; sdp = s->s_fs_info;
mnt->mnt_sb = s;
if (args.ar_meta) if (args.ar_meta)
mnt->mnt_root = dget(sdp->sd_master_dir); return dget(sdp->sd_master_dir);
else else
mnt->mnt_root = dget(sdp->sd_root_dir); return dget(sdp->sd_root_dir);
return 0;
error_super: error_super:
deactivate_locked_super(s); deactivate_locked_super(s);
return ERR_PTR(error);
error_bdev: error_bdev:
close_bdev_exclusive(bdev, mode); close_bdev_exclusive(bdev, mode);
return error; return ERR_PTR(error);
} }
static int set_meta_super(struct super_block *s, void *ptr) static int set_meta_super(struct super_block *s, void *ptr)
@ -1356,8 +1351,8 @@ static int set_meta_super(struct super_block *s, void *ptr)
return -EINVAL; return -EINVAL;
} }
static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags, static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
const char *dev_name, void *data, struct vfsmount *mnt) int flags, const char *dev_name, void *data)
{ {
struct super_block *s; struct super_block *s;
struct gfs2_sbd *sdp; struct gfs2_sbd *sdp;
@ -1368,23 +1363,21 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags,
if (error) { if (error) {
printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n", printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n",
dev_name, error); dev_name, error);
return error; return ERR_PTR(error);
} }
s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super,
path.dentry->d_inode->i_sb->s_bdev); path.dentry->d_inode->i_sb->s_bdev);
path_put(&path); path_put(&path);
if (IS_ERR(s)) { if (IS_ERR(s)) {
printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n"); printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n");
return PTR_ERR(s); return ERR_CAST(s);
} }
if ((flags ^ s->s_flags) & MS_RDONLY) { if ((flags ^ s->s_flags) & MS_RDONLY) {
deactivate_locked_super(s); deactivate_locked_super(s);
return -EBUSY; return ERR_PTR(-EBUSY);
} }
sdp = s->s_fs_info; sdp = s->s_fs_info;
mnt->mnt_sb = s; return dget(sdp->sd_master_dir);
mnt->mnt_root = dget(sdp->sd_master_dir);
return 0;
} }
static void gfs2_kill_sb(struct super_block *sb) static void gfs2_kill_sb(struct super_block *sb)
@ -1410,7 +1403,7 @@ static void gfs2_kill_sb(struct super_block *sb)
struct file_system_type gfs2_fs_type = { struct file_system_type gfs2_fs_type = {
.name = "gfs2", .name = "gfs2",
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
.get_sb = gfs2_get_sb, .mount = gfs2_mount,
.kill_sb = gfs2_kill_sb, .kill_sb = gfs2_kill_sb,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
@ -1418,7 +1411,7 @@ struct file_system_type gfs2_fs_type = {
struct file_system_type gfs2meta_fs_type = { struct file_system_type gfs2meta_fs_type = {
.name = "gfs2meta", .name = "gfs2meta",
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
.get_sb = gfs2_get_sb_meta, .mount = gfs2_mount_meta,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };

View File

@ -441,17 +441,16 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
return res; return res;
} }
static int hfs_get_sb(struct file_system_type *fs_type, static struct dentry *hfs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data, int flags, const char *dev_name, void *data)
struct vfsmount *mnt)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, hfs_fill_super, mnt); return mount_bdev(fs_type, flags, dev_name, data, hfs_fill_super);
} }
static struct file_system_type hfs_fs_type = { static struct file_system_type hfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "hfs", .name = "hfs",
.get_sb = hfs_get_sb, .mount = hfs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -495,18 +495,16 @@ static void hfsplus_destroy_inode(struct inode *inode)
#define HFSPLUS_INODE_SIZE sizeof(struct hfsplus_inode_info) #define HFSPLUS_INODE_SIZE sizeof(struct hfsplus_inode_info)
static int hfsplus_get_sb(struct file_system_type *fs_type, static struct dentry *hfsplus_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data, int flags, const char *dev_name, void *data)
struct vfsmount *mnt)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, hfsplus_fill_super, return mount_bdev(fs_type, flags, dev_name, data, hfsplus_fill_super);
mnt);
} }
static struct file_system_type hfsplus_fs_type = { static struct file_system_type hfsplus_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "hfsplus", .name = "hfsplus",
.get_sb = hfsplus_get_sb, .mount = hfsplus_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -962,11 +962,11 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
return err; return err;
} }
static int hostfs_read_sb(struct file_system_type *type, static struct dentry *hostfs_read_sb(struct file_system_type *type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
return get_sb_nodev(type, flags, data, hostfs_fill_sb_common, mnt); return mount_nodev(type, flags, data, hostfs_fill_sb_common);
} }
static void hostfs_kill_sb(struct super_block *s) static void hostfs_kill_sb(struct super_block *s)
@ -978,7 +978,7 @@ static void hostfs_kill_sb(struct super_block *s)
static struct file_system_type hostfs_type = { static struct file_system_type hostfs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "hostfs", .name = "hostfs",
.get_sb = hostfs_read_sb, .mount = hostfs_read_sb,
.kill_sb = hostfs_kill_sb, .kill_sb = hostfs_kill_sb,
.fs_flags = 0, .fs_flags = 0,
}; };

View File

@ -686,17 +686,16 @@ bail2: brelse(bh0);
return -EINVAL; return -EINVAL;
} }
static int hpfs_get_sb(struct file_system_type *fs_type, static struct dentry *hpfs_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, hpfs_fill_super, return mount_bdev(fs_type, flags, dev_name, data, hpfs_fill_super);
mnt);
} }
static struct file_system_type hpfs_fs_type = { static struct file_system_type hpfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "hpfs", .name = "hpfs",
.get_sb = hpfs_get_sb, .mount = hpfs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -748,17 +748,17 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent)
return(err); return(err);
} }
static int hppfs_read_super(struct file_system_type *type, static struct dentry *hppfs_read_super(struct file_system_type *type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
return get_sb_nodev(type, flags, data, hppfs_fill_super, mnt); return mount_nodev(type, flags, data, hppfs_fill_super);
} }
static struct file_system_type hppfs_type = { static struct file_system_type hppfs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "hppfs", .name = "hppfs",
.get_sb = hppfs_read_super, .mount = hppfs_read_super,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
.fs_flags = 0, .fs_flags = 0,
}; };

View File

@ -896,15 +896,15 @@ void hugetlb_put_quota(struct address_space *mapping, long delta)
} }
} }
static int hugetlbfs_get_sb(struct file_system_type *fs_type, static struct dentry *hugetlbfs_mount(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)
{ {
return get_sb_nodev(fs_type, flags, data, hugetlbfs_fill_super, mnt); return mount_nodev(fs_type, flags, data, hugetlbfs_fill_super);
} }
static struct file_system_type hugetlbfs_fs_type = { static struct file_system_type hugetlbfs_fs_type = {
.name = "hugetlbfs", .name = "hugetlbfs",
.get_sb = hugetlbfs_get_sb, .mount = hugetlbfs_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

View File

@ -106,5 +106,5 @@ extern void release_open_intent(struct nameidata *);
* inode.c * inode.c
*/ */
extern int get_nr_dirty_inodes(void); extern int get_nr_dirty_inodes(void);
extern int evict_inodes(struct super_block *); extern void evict_inodes(struct super_block *);
extern int invalidate_inodes(struct super_block *); extern int invalidate_inodes(struct super_block *);

View File

@ -1507,17 +1507,16 @@ struct inode *isofs_iget(struct super_block *sb,
return inode; return inode;
} }
static int isofs_get_sb(struct file_system_type *fs_type, static struct dentry *isofs_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, isofs_fill_super, return mount_bdev(fs_type, flags, dev_name, data, isofs_fill_super);
mnt);
} }
static struct file_system_type iso9660_fs_type = { static struct file_system_type iso9660_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "iso9660", .name = "iso9660",
.get_sb = isofs_get_sb, .mount = isofs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -179,12 +179,11 @@ static int jffs2_fill_super(struct super_block *sb, void *data, int silent)
return ret; return ret;
} }
static int jffs2_get_sb(struct file_system_type *fs_type, static struct dentry *jffs2_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
return get_sb_mtd(fs_type, flags, dev_name, data, jffs2_fill_super, return mount_mtd(fs_type, flags, dev_name, data, jffs2_fill_super);
mnt);
} }
static void jffs2_put_super (struct super_block *sb) static void jffs2_put_super (struct super_block *sb)
@ -229,7 +228,7 @@ static void jffs2_kill_sb(struct super_block *sb)
static struct file_system_type jffs2_fs_type = { static struct file_system_type jffs2_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "jffs2", .name = "jffs2",
.get_sb = jffs2_get_sb, .mount = jffs2_mount,
.kill_sb = jffs2_kill_sb, .kill_sb = jffs2_kill_sb,
}; };

View File

@ -583,11 +583,10 @@ static int jfs_unfreeze(struct super_block *sb)
return 0; return 0;
} }
static int jfs_get_sb(struct file_system_type *fs_type, static struct dentry *jfs_do_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, jfs_fill_super, return mount_bdev(fs_type, flags, dev_name, data, jfs_fill_super);
mnt);
} }
static int jfs_sync_fs(struct super_block *sb, int wait) static int jfs_sync_fs(struct super_block *sb, int wait)
@ -770,7 +769,7 @@ static const struct export_operations jfs_export_operations = {
static struct file_system_type jfs_fs_type = { static struct file_system_type jfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "jfs", .name = "jfs",
.get_sb = jfs_get_sb, .mount = jfs_do_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -201,9 +201,8 @@ static const struct super_operations simple_super_operations = {
* Common helper for pseudo-filesystems (sockfs, pipefs, bdev - stuff that * Common helper for pseudo-filesystems (sockfs, pipefs, bdev - stuff that
* will never be mountable) * will never be mountable)
*/ */
int get_sb_pseudo(struct file_system_type *fs_type, char *name, struct dentry *mount_pseudo(struct file_system_type *fs_type, char *name,
const struct super_operations *ops, unsigned long magic, const struct super_operations *ops, unsigned long magic)
struct vfsmount *mnt)
{ {
struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL);
struct dentry *dentry; struct dentry *dentry;
@ -211,7 +210,7 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name,
struct qstr d_name = {.name = name, .len = strlen(name)}; struct qstr d_name = {.name = name, .len = strlen(name)};
if (IS_ERR(s)) if (IS_ERR(s))
return PTR_ERR(s); return ERR_CAST(s);
s->s_flags = MS_NOUSER; s->s_flags = MS_NOUSER;
s->s_maxbytes = MAX_LFS_FILESIZE; s->s_maxbytes = MAX_LFS_FILESIZE;
@ -241,12 +240,11 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name,
d_instantiate(dentry, root); d_instantiate(dentry, root);
s->s_root = dentry; s->s_root = dentry;
s->s_flags |= MS_ACTIVE; s->s_flags |= MS_ACTIVE;
simple_set_mnt(mnt, s); return dget(s->s_root);
return 0;
Enomem: Enomem:
deactivate_locked_super(s); deactivate_locked_super(s);
return -ENOMEM; return ERR_PTR(-ENOMEM);
} }
int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
@ -951,7 +949,7 @@ EXPORT_SYMBOL(dcache_dir_lseek);
EXPORT_SYMBOL(dcache_dir_open); EXPORT_SYMBOL(dcache_dir_open);
EXPORT_SYMBOL(dcache_readdir); EXPORT_SYMBOL(dcache_readdir);
EXPORT_SYMBOL(generic_read_dir); EXPORT_SYMBOL(generic_read_dir);
EXPORT_SYMBOL(get_sb_pseudo); EXPORT_SYMBOL(mount_pseudo);
EXPORT_SYMBOL(simple_write_begin); EXPORT_SYMBOL(simple_write_begin);
EXPORT_SYMBOL(simple_write_end); EXPORT_SYMBOL(simple_write_end);
EXPORT_SYMBOL(simple_dir_inode_operations); EXPORT_SYMBOL(simple_dir_inode_operations);

View File

@ -298,9 +298,9 @@ static int bdev_write_sb(struct super_block *sb, struct page *page)
return sync_request(page, bdev, WRITE); return sync_request(page, bdev, WRITE);
} }
static void bdev_put_device(struct super_block *sb) static void bdev_put_device(struct logfs_super *s)
{ {
close_bdev_exclusive(logfs_super(sb)->s_bdev, FMODE_READ|FMODE_WRITE); close_bdev_exclusive(s->s_bdev, FMODE_READ|FMODE_WRITE);
} }
static int bdev_can_write_buf(struct super_block *sb, u64 ofs) static int bdev_can_write_buf(struct super_block *sb, u64 ofs)
@ -320,8 +320,8 @@ static const struct logfs_device_ops bd_devops = {
.put_device = bdev_put_device, .put_device = bdev_put_device,
}; };
int logfs_get_sb_bdev(struct file_system_type *type, int flags, int logfs_get_sb_bdev(struct logfs_super *p, struct file_system_type *type,
const char *devname, struct vfsmount *mnt) const char *devname)
{ {
struct block_device *bdev; struct block_device *bdev;
@ -332,8 +332,11 @@ int logfs_get_sb_bdev(struct file_system_type *type, int flags,
if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) { if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
int mtdnr = MINOR(bdev->bd_dev); int mtdnr = MINOR(bdev->bd_dev);
close_bdev_exclusive(bdev, FMODE_READ|FMODE_WRITE); close_bdev_exclusive(bdev, FMODE_READ|FMODE_WRITE);
return logfs_get_sb_mtd(type, flags, mtdnr, mnt); return logfs_get_sb_mtd(p, mtdnr);
} }
return logfs_get_sb_device(type, flags, NULL, bdev, &bd_devops, mnt); p->s_bdev = bdev;
p->s_mtd = NULL;
p->s_devops = &bd_devops;
return 0;
} }

View File

@ -230,9 +230,9 @@ static void mtd_writeseg(struct super_block *sb, u64 ofs, size_t len)
__mtd_writeseg(sb, ofs, ofs >> PAGE_SHIFT, len >> PAGE_SHIFT); __mtd_writeseg(sb, ofs, ofs >> PAGE_SHIFT, len >> PAGE_SHIFT);
} }
static void mtd_put_device(struct super_block *sb) static void mtd_put_device(struct logfs_super *s)
{ {
put_mtd_device(logfs_super(sb)->s_mtd); put_mtd_device(s->s_mtd);
} }
static int mtd_can_write_buf(struct super_block *sb, u64 ofs) static int mtd_can_write_buf(struct super_block *sb, u64 ofs)
@ -265,14 +265,14 @@ static const struct logfs_device_ops mtd_devops = {
.put_device = mtd_put_device, .put_device = mtd_put_device,
}; };
int logfs_get_sb_mtd(struct file_system_type *type, int flags, int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr)
int mtdnr, struct vfsmount *mnt)
{ {
struct mtd_info *mtd; struct mtd_info *mtd = get_mtd_device(NULL, mtdnr);
const struct logfs_device_ops *devops = &mtd_devops;
mtd = get_mtd_device(NULL, mtdnr);
if (IS_ERR(mtd)) if (IS_ERR(mtd))
return PTR_ERR(mtd); return PTR_ERR(mtd);
return logfs_get_sb_device(type, flags, mtd, NULL, devops, mnt);
s->s_bdev = NULL;
s->s_mtd = mtd;
s->s_devops = &mtd_devops;
return 0;
} }

View File

@ -136,6 +136,7 @@ struct logfs_area_ops {
int (*erase_segment)(struct logfs_area *area); int (*erase_segment)(struct logfs_area *area);
}; };
struct logfs_super; /* forward */
/** /**
* struct logfs_device_ops - device access operations * struct logfs_device_ops - device access operations
* *
@ -156,7 +157,7 @@ struct logfs_device_ops {
int ensure_write); int ensure_write);
int (*can_write_buf)(struct super_block *sb, u64 ofs); int (*can_write_buf)(struct super_block *sb, u64 ofs);
void (*sync)(struct super_block *sb); void (*sync)(struct super_block *sb);
void (*put_device)(struct super_block *sb); void (*put_device)(struct logfs_super *s);
}; };
/** /**
@ -471,11 +472,13 @@ void logfs_compr_exit(void);
/* dev_bdev.c */ /* dev_bdev.c */
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
int logfs_get_sb_bdev(struct file_system_type *type, int flags, int logfs_get_sb_bdev(struct logfs_super *s,
const char *devname, struct vfsmount *mnt); struct file_system_type *type,
const char *devname);
#else #else
static inline int logfs_get_sb_bdev(struct file_system_type *type, int flags, static inline int logfs_get_sb_bdev(struct logfs_super *s,
const char *devname, struct vfsmount *mnt) struct file_system_type *type,
const char *devname)
{ {
return -ENODEV; return -ENODEV;
} }
@ -483,11 +486,9 @@ static inline int logfs_get_sb_bdev(struct file_system_type *type, int flags,
/* dev_mtd.c */ /* dev_mtd.c */
#ifdef CONFIG_MTD #ifdef CONFIG_MTD
int logfs_get_sb_mtd(struct file_system_type *type, int flags, int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr)
int mtdnr, struct vfsmount *mnt);
#else #else
static inline int logfs_get_sb_mtd(struct file_system_type *type, int flags, static inline int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr)
int mtdnr, struct vfsmount *mnt)
{ {
return -ENODEV; return -ENODEV;
} }
@ -619,9 +620,6 @@ void emergency_read_end(struct page *page);
void logfs_crash_dump(struct super_block *sb); void logfs_crash_dump(struct super_block *sb);
void *memchr_inv(const void *s, int c, size_t n); void *memchr_inv(const void *s, int c, size_t n);
int logfs_statfs(struct dentry *dentry, struct kstatfs *stats); int logfs_statfs(struct dentry *dentry, struct kstatfs *stats);
int logfs_get_sb_device(struct file_system_type *type, int flags,
struct mtd_info *mtd, struct block_device *bdev,
const struct logfs_device_ops *devops, struct vfsmount *mnt);
int logfs_check_ds(struct logfs_disk_super *ds); int logfs_check_ds(struct logfs_disk_super *ds);
int logfs_write_sb(struct super_block *sb); int logfs_write_sb(struct super_block *sb);

View File

@ -325,7 +325,7 @@ static int logfs_make_writeable(struct super_block *sb)
return 0; return 0;
} }
static int logfs_get_sb_final(struct super_block *sb, struct vfsmount *mnt) static int logfs_get_sb_final(struct super_block *sb)
{ {
struct logfs_super *super = logfs_super(sb); struct logfs_super *super = logfs_super(sb);
struct inode *rootdir; struct inode *rootdir;
@ -356,7 +356,6 @@ static int logfs_get_sb_final(struct super_block *sb, struct vfsmount *mnt)
} }
log_super("LogFS: Finished mounting\n"); log_super("LogFS: Finished mounting\n");
simple_set_mnt(mnt, sb);
return 0; return 0;
fail: fail:
@ -529,43 +528,37 @@ static void logfs_kill_sb(struct super_block *sb)
logfs_cleanup_rw(sb); logfs_cleanup_rw(sb);
if (super->s_erase_page) if (super->s_erase_page)
__free_page(super->s_erase_page); __free_page(super->s_erase_page);
super->s_devops->put_device(sb); super->s_devops->put_device(super);
logfs_mempool_destroy(super->s_btree_pool); logfs_mempool_destroy(super->s_btree_pool);
logfs_mempool_destroy(super->s_alias_pool); logfs_mempool_destroy(super->s_alias_pool);
kfree(super); kfree(super);
log_super("LogFS: Finished unmounting\n"); log_super("LogFS: Finished unmounting\n");
} }
int logfs_get_sb_device(struct file_system_type *type, int flags, static struct dentry *logfs_get_sb_device(struct logfs_super *super,
struct mtd_info *mtd, struct block_device *bdev, struct file_system_type *type, int flags)
const struct logfs_device_ops *devops, struct vfsmount *mnt)
{ {
struct logfs_super *super;
struct super_block *sb; struct super_block *sb;
int err = -ENOMEM; int err = -ENOMEM;
static int mount_count; static int mount_count;
log_super("LogFS: Start mount %x\n", mount_count++); log_super("LogFS: Start mount %x\n", mount_count++);
super = kzalloc(sizeof(*super), GFP_KERNEL);
if (!super)
goto err0;
super->s_mtd = mtd;
super->s_bdev = bdev;
err = -EINVAL; err = -EINVAL;
sb = sget(type, logfs_sb_test, logfs_sb_set, super); sb = sget(type, logfs_sb_test, logfs_sb_set, super);
if (IS_ERR(sb)) if (IS_ERR(sb)) {
goto err0; super->s_devops->put_device(super);
kfree(super);
return ERR_CAST(sb);
}
if (sb->s_root) { if (sb->s_root) {
/* Device is already in use */ /* Device is already in use */
err = 0; super->s_devops->put_device(super);
simple_set_mnt(mnt, sb); kfree(super);
goto err0; return dget(sb->s_root);
} }
super->s_devops = devops;
/* /*
* sb->s_maxbytes is limited to 8TB. On 32bit systems, the page cache * sb->s_maxbytes is limited to 8TB. On 32bit systems, the page cache
* only covers 16TB and the upper 8TB are used for indirect blocks. * only covers 16TB and the upper 8TB are used for indirect blocks.
@ -581,10 +574,12 @@ int logfs_get_sb_device(struct file_system_type *type, int flags,
goto err1; goto err1;
sb->s_flags |= MS_ACTIVE; sb->s_flags |= MS_ACTIVE;
err = logfs_get_sb_final(sb, mnt); err = logfs_get_sb_final(sb);
if (err) if (err) {
deactivate_locked_super(sb); deactivate_locked_super(sb);
return err; return ERR_PTR(err);
}
return dget(sb->s_root);
err1: err1:
/* no ->s_root, no ->put_super() */ /* no ->s_root, no ->put_super() */
@ -592,37 +587,45 @@ int logfs_get_sb_device(struct file_system_type *type, int flags,
iput(super->s_segfile_inode); iput(super->s_segfile_inode);
iput(super->s_mapping_inode); iput(super->s_mapping_inode);
deactivate_locked_super(sb); deactivate_locked_super(sb);
return err; return ERR_PTR(err);
err0:
kfree(super);
//devops->put_device(sb);
return err;
} }
static int logfs_get_sb(struct file_system_type *type, int flags, static struct dentry *logfs_mount(struct file_system_type *type, int flags,
const char *devname, void *data, struct vfsmount *mnt) const char *devname, void *data)
{ {
ulong mtdnr; ulong mtdnr;
struct logfs_super *super;
int err;
super = kzalloc(sizeof(*super), GFP_KERNEL);
if (!super)
return ERR_PTR(-ENOMEM);
if (!devname) if (!devname)
return logfs_get_sb_bdev(type, flags, devname, mnt); err = logfs_get_sb_bdev(super, type, devname);
if (strncmp(devname, "mtd", 3)) else if (strncmp(devname, "mtd", 3))
return logfs_get_sb_bdev(type, flags, devname, mnt); err = logfs_get_sb_bdev(super, type, devname);
else {
{
char *garbage; char *garbage;
mtdnr = simple_strtoul(devname+3, &garbage, 0); mtdnr = simple_strtoul(devname+3, &garbage, 0);
if (*garbage) if (*garbage)
return -EINVAL; err = -EINVAL;
else
err = logfs_get_sb_mtd(super, mtdnr);
} }
return logfs_get_sb_mtd(type, flags, mtdnr, mnt); if (err) {
kfree(super);
return ERR_PTR(err);
}
return logfs_get_sb_device(super, type, flags);
} }
static struct file_system_type logfs_fs_type = { static struct file_system_type logfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "logfs", .name = "logfs",
.get_sb = logfs_get_sb, .mount = logfs_mount,
.kill_sb = logfs_kill_sb, .kill_sb = logfs_kill_sb,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,

View File

@ -614,17 +614,16 @@ void minix_truncate(struct inode * inode)
V2_minix_truncate(inode); V2_minix_truncate(inode);
} }
static int minix_get_sb(struct file_system_type *fs_type, static struct dentry *minix_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, minix_fill_super, return mount_bdev(fs_type, flags, dev_name, data, minix_fill_super);
mnt);
} }
static struct file_system_type minix_fs_type = { static struct file_system_type minix_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "minix", .name = "minix",
.get_sb = minix_get_sb, .mount = minix_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -1574,6 +1574,7 @@ static struct file *finish_open(struct nameidata *nd,
*/ */
if (will_truncate) if (will_truncate)
mnt_drop_write(nd->path.mnt); mnt_drop_write(nd->path.mnt);
path_put(&nd->path);
return filp; return filp;
exit: exit:
@ -1675,6 +1676,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
} }
filp = nameidata_to_filp(nd); filp = nameidata_to_filp(nd);
mnt_drop_write(nd->path.mnt); mnt_drop_write(nd->path.mnt);
path_put(&nd->path);
if (!IS_ERR(filp)) { if (!IS_ERR(filp)) {
error = ima_file_check(filp, acc_mode); error = ima_file_check(filp, acc_mode);
if (error) { if (error) {

View File

@ -1020,16 +1020,16 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr)
return result; return result;
} }
static int ncp_get_sb(struct file_system_type *fs_type, static struct dentry *ncp_mount(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)
{ {
return get_sb_nodev(fs_type, flags, data, ncp_fill_super, mnt); return mount_nodev(fs_type, flags, data, ncp_fill_super);
} }
static struct file_system_type ncp_fs_type = { static struct file_system_type ncp_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ncpfs", .name = "ncpfs",
.get_sb = ncp_get_sb, .mount = ncp_mount,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
.fs_flags = FS_BINARY_MOUNTDATA, .fs_flags = FS_BINARY_MOUNTDATA,
}; };

View File

@ -260,8 +260,8 @@ static int nfs_statfs(struct dentry *, struct kstatfs *);
static int nfs_show_options(struct seq_file *, struct vfsmount *); static int nfs_show_options(struct seq_file *, struct vfsmount *);
static int nfs_show_stats(struct seq_file *, struct vfsmount *); static int nfs_show_stats(struct seq_file *, struct vfsmount *);
static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *); static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *);
static int nfs_xdev_get_sb(struct file_system_type *fs_type, static struct dentry *nfs_xdev_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); int flags, const char *dev_name, void *raw_data);
static void nfs_put_super(struct super_block *); static void nfs_put_super(struct super_block *);
static void nfs_kill_super(struct super_block *); static void nfs_kill_super(struct super_block *);
static int nfs_remount(struct super_block *sb, int *flags, char *raw_data); static int nfs_remount(struct super_block *sb, int *flags, char *raw_data);
@ -277,7 +277,7 @@ static struct file_system_type nfs_fs_type = {
struct file_system_type nfs_xdev_fs_type = { struct file_system_type nfs_xdev_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "nfs", .name = "nfs",
.get_sb = nfs_xdev_get_sb, .mount = nfs_xdev_mount,
.kill_sb = nfs_kill_super, .kill_sb = nfs_kill_super,
.fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
}; };
@ -302,14 +302,14 @@ static int nfs4_try_mount(int flags, const char *dev_name,
struct nfs_parsed_mount_data *data, struct vfsmount *mnt); struct nfs_parsed_mount_data *data, struct vfsmount *mnt);
static int nfs4_get_sb(struct file_system_type *fs_type, static int nfs4_get_sb(struct file_system_type *fs_type,
int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt);
static int nfs4_remote_get_sb(struct file_system_type *fs_type, static struct dentry *nfs4_remote_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); int flags, const char *dev_name, void *raw_data);
static int nfs4_xdev_get_sb(struct file_system_type *fs_type, static struct dentry *nfs4_xdev_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); int flags, const char *dev_name, void *raw_data);
static int nfs4_referral_get_sb(struct file_system_type *fs_type, static int nfs4_referral_get_sb(struct file_system_type *fs_type,
int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt);
static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type, static struct dentry *nfs4_remote_referral_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); int flags, const char *dev_name, void *raw_data);
static void nfs4_kill_super(struct super_block *sb); static void nfs4_kill_super(struct super_block *sb);
static struct file_system_type nfs4_fs_type = { static struct file_system_type nfs4_fs_type = {
@ -323,7 +323,7 @@ static struct file_system_type nfs4_fs_type = {
static struct file_system_type nfs4_remote_fs_type = { static struct file_system_type nfs4_remote_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "nfs4", .name = "nfs4",
.get_sb = nfs4_remote_get_sb, .mount = nfs4_remote_mount,
.kill_sb = nfs4_kill_super, .kill_sb = nfs4_kill_super,
.fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
}; };
@ -331,7 +331,7 @@ static struct file_system_type nfs4_remote_fs_type = {
struct file_system_type nfs4_xdev_fs_type = { struct file_system_type nfs4_xdev_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "nfs4", .name = "nfs4",
.get_sb = nfs4_xdev_get_sb, .mount = nfs4_xdev_mount,
.kill_sb = nfs4_kill_super, .kill_sb = nfs4_kill_super,
.fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
}; };
@ -339,7 +339,7 @@ struct file_system_type nfs4_xdev_fs_type = {
static struct file_system_type nfs4_remote_referral_fs_type = { static struct file_system_type nfs4_remote_referral_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "nfs4", .name = "nfs4",
.get_sb = nfs4_remote_referral_get_sb, .mount = nfs4_remote_referral_mount,
.kill_sb = nfs4_kill_super, .kill_sb = nfs4_kill_super,
.fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
}; };
@ -2397,9 +2397,9 @@ static void nfs_kill_super(struct super_block *s)
/* /*
* Clone an NFS2/3 server record on xdev traversal (FSID-change) * Clone an NFS2/3 server record on xdev traversal (FSID-change)
*/ */
static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *
const char *dev_name, void *raw_data, nfs_xdev_mount(struct file_system_type *fs_type, int flags,
struct vfsmount *mnt) const char *dev_name, void *raw_data)
{ {
struct nfs_clone_mount *data = raw_data; struct nfs_clone_mount *data = raw_data;
struct super_block *s; struct super_block *s;
@ -2411,7 +2411,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
}; };
int error; int error;
dprintk("--> nfs_xdev_get_sb()\n"); dprintk("--> nfs_xdev_mount()\n");
/* create a new volume representation */ /* create a new volume representation */
server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr); server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr);
@ -2458,28 +2458,26 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
} }
s->s_flags |= MS_ACTIVE; s->s_flags |= MS_ACTIVE;
mnt->mnt_sb = s;
mnt->mnt_root = mntroot;
/* clone any lsm security options from the parent to the new sb */ /* clone any lsm security options from the parent to the new sb */
security_sb_clone_mnt_opts(data->sb, s); security_sb_clone_mnt_opts(data->sb, s);
dprintk("<-- nfs_xdev_get_sb() = 0\n"); dprintk("<-- nfs_xdev_mount() = 0\n");
return 0; return mntroot;
out_err_nosb: out_err_nosb:
nfs_free_server(server); nfs_free_server(server);
out_err_noserver: out_err_noserver:
dprintk("<-- nfs_xdev_get_sb() = %d [error]\n", error); dprintk("<-- nfs_xdev_mount() = %d [error]\n", error);
return error; return ERR_PTR(error);
error_splat_super: error_splat_super:
if (server && !s->s_root) if (server && !s->s_root)
bdi_unregister(&server->backing_dev_info); bdi_unregister(&server->backing_dev_info);
error_splat_bdi: error_splat_bdi:
deactivate_locked_super(s); deactivate_locked_super(s);
dprintk("<-- nfs_xdev_get_sb() = %d [splat]\n", error); dprintk("<-- nfs_xdev_mount() = %d [splat]\n", error);
return error; return ERR_PTR(error);
} }
#ifdef CONFIG_NFS_V4 #ifdef CONFIG_NFS_V4
@ -2649,8 +2647,9 @@ static int nfs4_validate_mount_data(void *options,
/* /*
* Get the superblock for the NFS4 root partition * Get the superblock for the NFS4 root partition
*/ */
static int nfs4_remote_get_sb(struct file_system_type *fs_type, static struct dentry *
int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt) nfs4_remote_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *raw_data)
{ {
struct nfs_parsed_mount_data *data = raw_data; struct nfs_parsed_mount_data *data = raw_data;
struct super_block *s; struct super_block *s;
@ -2714,15 +2713,16 @@ static int nfs4_remote_get_sb(struct file_system_type *fs_type,
goto error_splat_root; goto error_splat_root;
s->s_flags |= MS_ACTIVE; s->s_flags |= MS_ACTIVE;
mnt->mnt_sb = s;
mnt->mnt_root = mntroot; security_free_mnt_opts(&data->lsm_opts);
error = 0; nfs_free_fhandle(mntfh);
return mntroot;
out: out:
security_free_mnt_opts(&data->lsm_opts); security_free_mnt_opts(&data->lsm_opts);
out_free_fh: out_free_fh:
nfs_free_fhandle(mntfh); nfs_free_fhandle(mntfh);
return error; return ERR_PTR(error);
out_free: out_free:
nfs_free_server(server); nfs_free_server(server);
@ -2968,9 +2968,9 @@ static void nfs4_kill_super(struct super_block *sb)
/* /*
* Clone an NFS4 server record on xdev traversal (FSID-change) * Clone an NFS4 server record on xdev traversal (FSID-change)
*/ */
static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *
const char *dev_name, void *raw_data, nfs4_xdev_mount(struct file_system_type *fs_type, int flags,
struct vfsmount *mnt) const char *dev_name, void *raw_data)
{ {
struct nfs_clone_mount *data = raw_data; struct nfs_clone_mount *data = raw_data;
struct super_block *s; struct super_block *s;
@ -2982,7 +2982,7 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
}; };
int error; int error;
dprintk("--> nfs4_xdev_get_sb()\n"); dprintk("--> nfs4_xdev_mount()\n");
/* create a new volume representation */ /* create a new volume representation */
server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr); server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr);
@ -3029,32 +3029,30 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
} }
s->s_flags |= MS_ACTIVE; s->s_flags |= MS_ACTIVE;
mnt->mnt_sb = s;
mnt->mnt_root = mntroot;
security_sb_clone_mnt_opts(data->sb, s); security_sb_clone_mnt_opts(data->sb, s);
dprintk("<-- nfs4_xdev_get_sb() = 0\n"); dprintk("<-- nfs4_xdev_mount() = 0\n");
return 0; return mntroot;
out_err_nosb: out_err_nosb:
nfs_free_server(server); nfs_free_server(server);
out_err_noserver: out_err_noserver:
dprintk("<-- nfs4_xdev_get_sb() = %d [error]\n", error); dprintk("<-- nfs4_xdev_mount() = %d [error]\n", error);
return error; return ERR_PTR(error);
error_splat_super: error_splat_super:
if (server && !s->s_root) if (server && !s->s_root)
bdi_unregister(&server->backing_dev_info); bdi_unregister(&server->backing_dev_info);
error_splat_bdi: error_splat_bdi:
deactivate_locked_super(s); deactivate_locked_super(s);
dprintk("<-- nfs4_xdev_get_sb() = %d [splat]\n", error); dprintk("<-- nfs4_xdev_mount() = %d [splat]\n", error);
return error; return ERR_PTR(error);
} }
static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type, static struct dentry *
int flags, const char *dev_name, void *raw_data, nfs4_remote_referral_mount(struct file_system_type *fs_type, int flags,
struct vfsmount *mnt) const char *dev_name, void *raw_data)
{ {
struct nfs_clone_mount *data = raw_data; struct nfs_clone_mount *data = raw_data;
struct super_block *s; struct super_block *s;
@ -3118,14 +3116,12 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type,
} }
s->s_flags |= MS_ACTIVE; s->s_flags |= MS_ACTIVE;
mnt->mnt_sb = s;
mnt->mnt_root = mntroot;
security_sb_clone_mnt_opts(data->sb, s); security_sb_clone_mnt_opts(data->sb, s);
nfs_free_fhandle(mntfh); nfs_free_fhandle(mntfh);
dprintk("<-- nfs4_referral_get_sb() = 0\n"); dprintk("<-- nfs4_referral_get_sb() = 0\n");
return 0; return mntroot;
out_err_nosb: out_err_nosb:
nfs_free_server(server); nfs_free_server(server);
@ -3133,7 +3129,7 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type,
nfs_free_fhandle(mntfh); nfs_free_fhandle(mntfh);
out_err_nofh: out_err_nofh:
dprintk("<-- nfs4_referral_get_sb() = %d [error]\n", error); dprintk("<-- nfs4_referral_get_sb() = %d [error]\n", error);
return error; return ERR_PTR(error);
error_splat_super: error_splat_super:
if (server && !s->s_root) if (server && !s->s_root)
@ -3142,7 +3138,7 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type,
deactivate_locked_super(s); deactivate_locked_super(s);
nfs_free_fhandle(mntfh); nfs_free_fhandle(mntfh);
dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error); dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error);
return error; return ERR_PTR(error);
} }
/* /*

View File

@ -444,9 +444,9 @@ nfs_async_rename(struct inode *old_dir, struct inode *new_dir,
/* set up nfs_renamedata */ /* set up nfs_renamedata */
data->old_dir = old_dir; data->old_dir = old_dir;
atomic_inc(&old_dir->i_count); ihold(old_dir);
data->new_dir = new_dir; data->new_dir = new_dir;
atomic_inc(&new_dir->i_count); ihold(new_dir);
data->old_dentry = dget(old_dentry); data->old_dentry = dget(old_dentry);
data->new_dentry = dget(new_dentry); data->new_dentry = dget(new_dentry);
nfs_fattr_init(&data->old_fattr); nfs_fattr_init(&data->old_fattr);

View File

@ -1405,16 +1405,16 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent)
return simple_fill_super(sb, 0x6e667364, nfsd_files); return simple_fill_super(sb, 0x6e667364, nfsd_files);
} }
static int nfsd_get_sb(struct file_system_type *fs_type, static struct dentry *nfsd_mount(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)
{ {
return get_sb_single(fs_type, flags, data, nfsd_fill_super, mnt); return mount_single(fs_type, flags, data, nfsd_fill_super);
} }
static struct file_system_type nfsd_fs_type = { static struct file_system_type nfsd_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "nfsd", .name = "nfsd",
.get_sb = nfsd_get_sb, .mount = nfsd_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

View File

@ -1141,9 +1141,9 @@ static int nilfs_test_bdev_super(struct super_block *s, void *data)
return (void *)s->s_bdev == data; return (void *)s->s_bdev == data;
} }
static int static struct dentry *
nilfs_get_sb(struct file_system_type *fs_type, int flags, nilfs_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, struct vfsmount *mnt) const char *dev_name, void *data)
{ {
struct nilfs_super_data sd; struct nilfs_super_data sd;
struct super_block *s; struct super_block *s;
@ -1156,7 +1156,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
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))
return PTR_ERR(sd.bdev); return ERR_CAST(sd.bdev);
sd.cno = 0; sd.cno = 0;
sd.flags = flags; sd.flags = flags;
@ -1235,9 +1235,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
if (!s_new) if (!s_new)
close_bdev_exclusive(sd.bdev, mode); close_bdev_exclusive(sd.bdev, mode);
mnt->mnt_sb = s; return root_dentry;
mnt->mnt_root = root_dentry;
return 0;
failed_super: failed_super:
deactivate_locked_super(s); deactivate_locked_super(s);
@ -1245,13 +1243,13 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
failed: failed:
if (!s_new) if (!s_new)
close_bdev_exclusive(sd.bdev, mode); close_bdev_exclusive(sd.bdev, mode);
return err; return ERR_PTR(err);
} }
struct file_system_type nilfs_fs_type = { struct file_system_type nilfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "nilfs2", .name = "nilfs2",
.get_sb = nilfs_get_sb, .mount = nilfs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -3059,17 +3059,16 @@ struct kmem_cache *ntfs_index_ctx_cache;
/* Driver wide mutex. */ /* Driver wide mutex. */
DEFINE_MUTEX(ntfs_lock); DEFINE_MUTEX(ntfs_lock);
static int ntfs_get_sb(struct file_system_type *fs_type, static struct dentry *ntfs_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, ntfs_fill_super, return mount_bdev(fs_type, flags, dev_name, data, ntfs_fill_super);
mnt);
} }
static struct file_system_type ntfs_fs_type = { static struct file_system_type ntfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ntfs", .name = "ntfs",
.get_sb = ntfs_get_sb, .mount = ntfs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -643,16 +643,16 @@ static const struct inode_operations dlmfs_file_inode_operations = {
.setattr = dlmfs_file_setattr, .setattr = dlmfs_file_setattr,
}; };
static int dlmfs_get_sb(struct file_system_type *fs_type, static struct dentry *dlmfs_mount(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)
{ {
return get_sb_nodev(fs_type, flags, data, dlmfs_fill_super, mnt); return mount_nodev(fs_type, flags, data, dlmfs_fill_super);
} }
static struct file_system_type dlmfs_fs_type = { static struct file_system_type dlmfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ocfs2_dlmfs", .name = "ocfs2_dlmfs",
.get_sb = dlmfs_get_sb, .mount = dlmfs_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

View File

@ -1236,14 +1236,12 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
return status; return status;
} }
static int ocfs2_get_sb(struct file_system_type *fs_type, static struct dentry *ocfs2_mount(struct file_system_type *fs_type,
int flags, int flags,
const char *dev_name, const char *dev_name,
void *data, void *data)
struct vfsmount *mnt)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, ocfs2_fill_super, return mount_bdev(fs_type, flags, dev_name, data, ocfs2_fill_super);
mnt);
} }
static void ocfs2_kill_sb(struct super_block *sb) static void ocfs2_kill_sb(struct super_block *sb)
@ -1267,8 +1265,7 @@ static void ocfs2_kill_sb(struct super_block *sb)
static struct file_system_type ocfs2_fs_type = { static struct file_system_type ocfs2_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ocfs2", .name = "ocfs2",
.get_sb = ocfs2_get_sb, /* is this called when we mount .mount = ocfs2_mount,
* the fs? */
.kill_sb = ocfs2_kill_sb, .kill_sb = ocfs2_kill_sb,
.fs_flags = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE, .fs_flags = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE,

View File

@ -557,17 +557,16 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent)
return ret; return ret;
} }
static int omfs_get_sb(struct file_system_type *fs_type, static struct dentry *omfs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name, void *data)
void *data, struct vfsmount *m)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, omfs_fill_super, m); return mount_bdev(fs_type, flags, dev_name, data, omfs_fill_super);
} }
static struct file_system_type omfs_fs_type = { static struct file_system_type omfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "omfs", .name = "omfs",
.get_sb = omfs_get_sb, .mount = omfs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -786,11 +786,11 @@ struct file *nameidata_to_filp(struct nameidata *nd)
/* Pick up the filp from the open intent */ /* Pick up the filp from the open intent */
filp = nd->intent.open.file; filp = nd->intent.open.file;
/* Has the filesystem initialised the file for us? */ /* Has the filesystem initialised the file for us? */
if (filp->f_path.dentry == NULL) if (filp->f_path.dentry == NULL) {
path_get(&nd->path);
filp = __dentry_open(nd->path.dentry, nd->path.mnt, filp, filp = __dentry_open(nd->path.dentry, nd->path.mnt, filp,
NULL, cred); NULL, cred);
else }
path_put(&nd->path);
return filp; return filp;
} }

View File

@ -415,16 +415,16 @@ static int openprom_fill_super(struct super_block *s, void *data, int silent)
return ret; return ret;
} }
static int openprom_get_sb(struct file_system_type *fs_type, static struct dentry *openprom_mount(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)
{ {
return get_sb_single(fs_type, flags, data, openprom_fill_super, mnt); return mount_single(fs_type, flags, data, openprom_fill_super)
} }
static struct file_system_type openprom_fs_type = { static struct file_system_type openprom_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "openpromfs", .name = "openpromfs",
.get_sb = openprom_get_sb, .mount = openprom_mount,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
}; };

View File

@ -1247,16 +1247,15 @@ long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg)
* any operations on the root directory. However, we need a non-trivial * any operations on the root directory. However, we need a non-trivial
* d_name - pipe: will go nicely and kill the special-casing in procfs. * d_name - pipe: will go nicely and kill the special-casing in procfs.
*/ */
static int pipefs_get_sb(struct file_system_type *fs_type, static struct dentry *pipefs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data, int flags, const char *dev_name, void *data)
struct vfsmount *mnt)
{ {
return get_sb_pseudo(fs_type, "pipe:", NULL, PIPEFS_MAGIC, mnt); return mount_pseudo(fs_type, "pipe:", NULL, PIPEFS_MAGIC);
} }
static struct file_system_type pipe_fs_type = { static struct file_system_type pipe_fs_type = {
.name = "pipefs", .name = "pipefs",
.get_sb = pipefs_get_sb, .mount = pipefs_mount,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
}; };

View File

@ -35,8 +35,8 @@ static int proc_set_super(struct super_block *sb, void *data)
return set_anon_super(sb, NULL); return set_anon_super(sb, NULL);
} }
static int proc_get_sb(struct file_system_type *fs_type, static struct dentry *proc_mount(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)
{ {
int err; int err;
struct super_block *sb; struct super_block *sb;
@ -61,14 +61,14 @@ static int proc_get_sb(struct file_system_type *fs_type,
sb = sget(fs_type, proc_test_super, proc_set_super, ns); sb = sget(fs_type, proc_test_super, proc_set_super, ns);
if (IS_ERR(sb)) if (IS_ERR(sb))
return PTR_ERR(sb); return ERR_CAST(sb);
if (!sb->s_root) { if (!sb->s_root) {
sb->s_flags = flags; sb->s_flags = flags;
err = proc_fill_super(sb); err = proc_fill_super(sb);
if (err) { if (err) {
deactivate_locked_super(sb); deactivate_locked_super(sb);
return err; return ERR_PTR(err);
} }
ei = PROC_I(sb->s_root->d_inode); ei = PROC_I(sb->s_root->d_inode);
@ -79,11 +79,9 @@ static int proc_get_sb(struct file_system_type *fs_type,
} }
sb->s_flags |= MS_ACTIVE; sb->s_flags |= MS_ACTIVE;
ns->proc_mnt = mnt;
} }
simple_set_mnt(mnt, sb); return dget(sb->s_root);
return 0;
} }
static void proc_kill_sb(struct super_block *sb) static void proc_kill_sb(struct super_block *sb)
@ -97,7 +95,7 @@ static void proc_kill_sb(struct super_block *sb)
static struct file_system_type proc_fs_type = { static struct file_system_type proc_fs_type = {
.name = "proc", .name = "proc",
.get_sb = proc_get_sb, .mount = proc_mount,
.kill_sb = proc_kill_sb, .kill_sb = proc_kill_sb,
}; };
@ -115,6 +113,7 @@ void __init proc_root_init(void)
return; return;
} }
init_pid_ns.proc_mnt = proc_mnt;
proc_symlink("mounts", NULL, "self/mounts"); proc_symlink("mounts", NULL, "self/mounts");
proc_net_init(); proc_net_init();
@ -213,6 +212,7 @@ int pid_ns_prepare_proc(struct pid_namespace *ns)
if (IS_ERR(mnt)) if (IS_ERR(mnt))
return PTR_ERR(mnt); return PTR_ERR(mnt);
ns->proc_mnt = mnt;
return 0; return 0;
} }

View File

@ -454,17 +454,16 @@ static void destroy_inodecache(void)
kmem_cache_destroy(qnx4_inode_cachep); kmem_cache_destroy(qnx4_inode_cachep);
} }
static int qnx4_get_sb(struct file_system_type *fs_type, static struct dentry *qnx4_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, qnx4_fill_super, return mount_bdev(fs_type, flags, dev_name, data, qnx4_fill_super);
mnt);
} }
static struct file_system_type qnx4_fs_type = { static struct file_system_type qnx4_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "qnx4", .name = "qnx4",
.get_sb = qnx4_get_sb, .mount = qnx4_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -255,17 +255,16 @@ int ramfs_fill_super(struct super_block *sb, void *data, int silent)
return err; return err;
} }
int ramfs_get_sb(struct file_system_type *fs_type, struct dentry *ramfs_mount(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)
{ {
return get_sb_nodev(fs_type, flags, data, ramfs_fill_super, mnt); return mount_nodev(fs_type, flags, data, ramfs_fill_super);
} }
static int rootfs_get_sb(struct file_system_type *fs_type, static struct dentry *rootfs_mount(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)
{ {
return get_sb_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super, return mount_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super);
mnt);
} }
static void ramfs_kill_sb(struct super_block *sb) static void ramfs_kill_sb(struct super_block *sb)
@ -276,12 +275,12 @@ static void ramfs_kill_sb(struct super_block *sb)
static struct file_system_type ramfs_fs_type = { static struct file_system_type ramfs_fs_type = {
.name = "ramfs", .name = "ramfs",
.get_sb = ramfs_get_sb, .mount = ramfs_mount,
.kill_sb = ramfs_kill_sb, .kill_sb = ramfs_kill_sb,
}; };
static struct file_system_type rootfs_fs_type = { static struct file_system_type rootfs_fs_type = {
.name = "rootfs", .name = "rootfs",
.get_sb = rootfs_get_sb, .mount = rootfs_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

View File

@ -2213,12 +2213,11 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
#endif #endif
static int get_super_block(struct file_system_type *fs_type, static struct dentry *get_super_block(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, reiserfs_fill_super, return mount_bdev(fs_type, flags, dev_name, data, reiserfs_fill_super);
mnt);
} }
static int __init init_reiserfs_fs(void) static int __init init_reiserfs_fs(void)
@ -2253,7 +2252,7 @@ static void __exit exit_reiserfs_fs(void)
struct file_system_type reiserfs_fs_type = { struct file_system_type reiserfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "reiserfs", .name = "reiserfs",
.get_sb = get_super_block, .mount = get_super_block,
.kill_sb = reiserfs_kill_sb, .kill_sb = reiserfs_kill_sb,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -552,20 +552,19 @@ static int romfs_fill_super(struct super_block *sb, void *data, int silent)
/* /*
* get a superblock for mounting * get a superblock for mounting
*/ */
static int romfs_get_sb(struct file_system_type *fs_type, static struct dentry *romfs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
int ret = -EINVAL; struct dentry *ret = ERR_PTR(-EINVAL);
#ifdef CONFIG_ROMFS_ON_MTD #ifdef CONFIG_ROMFS_ON_MTD
ret = get_sb_mtd(fs_type, flags, dev_name, data, romfs_fill_super, ret = mount_mtd(fs_type, flags, dev_name, data, romfs_fill_super);
mnt);
#endif #endif
#ifdef CONFIG_ROMFS_ON_BLOCK #ifdef CONFIG_ROMFS_ON_BLOCK
if (ret == -EINVAL) if (ret == ERR_PTR(-EINVAL))
ret = get_sb_bdev(fs_type, flags, dev_name, data, ret = mount_bdev(fs_type, flags, dev_name, data,
romfs_fill_super, mnt); romfs_fill_super);
#endif #endif
return ret; return ret;
} }
@ -592,7 +591,7 @@ static void romfs_kill_sb(struct super_block *sb)
static struct file_system_type romfs_fs_type = { static struct file_system_type romfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "romfs", .name = "romfs",
.get_sb = romfs_get_sb, .mount = romfs_mount,
.kill_sb = romfs_kill_sb, .kill_sb = romfs_kill_sb,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -370,12 +370,10 @@ static void squashfs_put_super(struct super_block *sb)
} }
static int squashfs_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *squashfs_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, const char *dev_name, void *data)
struct vfsmount *mnt)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, squashfs_fill_super, return mount_bdev(fs_type, flags, dev_name, data, squashfs_fill_super);
mnt);
} }
@ -451,7 +449,7 @@ static void squashfs_destroy_inode(struct inode *inode)
static struct file_system_type squashfs_fs_type = { static struct file_system_type squashfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "squashfs", .name = "squashfs",
.get_sb = squashfs_get_sb, .mount = squashfs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV .fs_flags = FS_REQUIRES_DEV
}; };

View File

@ -715,15 +715,14 @@ static int ns_set_super(struct super_block *sb, void *data)
return set_anon_super(sb, NULL); return set_anon_super(sb, NULL);
} }
int get_sb_ns(struct file_system_type *fs_type, int flags, void *data, struct dentry *mount_ns(struct file_system_type *fs_type, int flags,
int (*fill_super)(struct super_block *, void *, int), void *data, int (*fill_super)(struct super_block *, void *, int))
struct vfsmount *mnt)
{ {
struct super_block *sb; struct super_block *sb;
sb = sget(fs_type, ns_test_super, ns_set_super, data); sb = sget(fs_type, ns_test_super, ns_set_super, data);
if (IS_ERR(sb)) if (IS_ERR(sb))
return PTR_ERR(sb); return ERR_CAST(sb);
if (!sb->s_root) { if (!sb->s_root) {
int err; int err;
@ -731,17 +730,16 @@ int get_sb_ns(struct file_system_type *fs_type, int flags, void *data,
err = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); err = fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
if (err) { if (err) {
deactivate_locked_super(sb); deactivate_locked_super(sb);
return err; return ERR_PTR(err);
} }
sb->s_flags |= MS_ACTIVE; sb->s_flags |= MS_ACTIVE;
} }
simple_set_mnt(mnt, sb); return dget(sb->s_root);
return 0;
} }
EXPORT_SYMBOL(get_sb_ns); EXPORT_SYMBOL(mount_ns);
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
static int set_bdev_super(struct super_block *s, void *data) static int set_bdev_super(struct super_block *s, void *data)
@ -762,10 +760,9 @@ static int test_bdev_super(struct super_block *s, void *data)
return (void *)s->s_bdev == data; return (void *)s->s_bdev == data;
} }
int get_sb_bdev(struct file_system_type *fs_type, struct dentry *mount_bdev(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data, int flags, const char *dev_name, void *data,
int (*fill_super)(struct super_block *, void *, int), int (*fill_super)(struct super_block *, void *, int))
struct vfsmount *mnt)
{ {
struct block_device *bdev; struct block_device *bdev;
struct super_block *s; struct super_block *s;
@ -777,7 +774,7 @@ int get_sb_bdev(struct file_system_type *fs_type,
bdev = open_bdev_exclusive(dev_name, mode, fs_type); bdev = open_bdev_exclusive(dev_name, mode, fs_type);
if (IS_ERR(bdev)) if (IS_ERR(bdev))
return PTR_ERR(bdev); return ERR_CAST(bdev);
/* /*
* once the super is inserted into the list by sget, s_umount * once the super is inserted into the list by sget, s_umount
@ -829,15 +826,30 @@ int get_sb_bdev(struct file_system_type *fs_type,
bdev->bd_super = s; bdev->bd_super = s;
} }
simple_set_mnt(mnt, s); return dget(s->s_root);
return 0;
error_s: error_s:
error = PTR_ERR(s); error = PTR_ERR(s);
error_bdev: error_bdev:
close_bdev_exclusive(bdev, mode); close_bdev_exclusive(bdev, mode);
error: error:
return error; return ERR_PTR(error);
}
EXPORT_SYMBOL(mount_bdev);
int get_sb_bdev(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data,
int (*fill_super)(struct super_block *, void *, int),
struct vfsmount *mnt)
{
struct dentry *root;
root = mount_bdev(fs_type, flags, dev_name, data, fill_super);
if (IS_ERR(root))
return PTR_ERR(root);
mnt->mnt_root = root;
mnt->mnt_sb = root->d_sb;
return 0;
} }
EXPORT_SYMBOL(get_sb_bdev); EXPORT_SYMBOL(get_sb_bdev);
@ -856,29 +868,42 @@ void kill_block_super(struct super_block *sb)
EXPORT_SYMBOL(kill_block_super); EXPORT_SYMBOL(kill_block_super);
#endif #endif
int get_sb_nodev(struct file_system_type *fs_type, struct dentry *mount_nodev(struct file_system_type *fs_type,
int flags, void *data, int flags, void *data,
int (*fill_super)(struct super_block *, void *, int), int (*fill_super)(struct super_block *, void *, int))
struct vfsmount *mnt)
{ {
int error; int error;
struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL);
if (IS_ERR(s)) if (IS_ERR(s))
return PTR_ERR(s); return ERR_CAST(s);
s->s_flags = flags; s->s_flags = flags;
error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
if (error) { if (error) {
deactivate_locked_super(s); deactivate_locked_super(s);
return error; return ERR_PTR(error);
} }
s->s_flags |= MS_ACTIVE; s->s_flags |= MS_ACTIVE;
simple_set_mnt(mnt, s); return dget(s->s_root);
}
EXPORT_SYMBOL(mount_nodev);
int get_sb_nodev(struct file_system_type *fs_type,
int flags, void *data,
int (*fill_super)(struct super_block *, void *, int),
struct vfsmount *mnt)
{
struct dentry *root;
root = mount_nodev(fs_type, flags, data, fill_super);
if (IS_ERR(root))
return PTR_ERR(root);
mnt->mnt_root = root;
mnt->mnt_sb = root->d_sb;
return 0; return 0;
} }
EXPORT_SYMBOL(get_sb_nodev); EXPORT_SYMBOL(get_sb_nodev);
static int compare_single(struct super_block *s, void *p) static int compare_single(struct super_block *s, void *p)
@ -886,29 +911,42 @@ static int compare_single(struct super_block *s, void *p)
return 1; return 1;
} }
int get_sb_single(struct file_system_type *fs_type, struct dentry *mount_single(struct file_system_type *fs_type,
int flags, void *data, int flags, void *data,
int (*fill_super)(struct super_block *, void *, int), int (*fill_super)(struct super_block *, void *, int))
struct vfsmount *mnt)
{ {
struct super_block *s; struct super_block *s;
int error; int error;
s = sget(fs_type, compare_single, set_anon_super, NULL); s = sget(fs_type, compare_single, set_anon_super, NULL);
if (IS_ERR(s)) if (IS_ERR(s))
return PTR_ERR(s); return ERR_CAST(s);
if (!s->s_root) { if (!s->s_root) {
s->s_flags = flags; s->s_flags = flags;
error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
if (error) { if (error) {
deactivate_locked_super(s); deactivate_locked_super(s);
return error; return ERR_PTR(error);
} }
s->s_flags |= MS_ACTIVE; s->s_flags |= MS_ACTIVE;
} else { } else {
do_remount_sb(s, flags, data, 0); do_remount_sb(s, flags, data, 0);
} }
simple_set_mnt(mnt, s); return dget(s->s_root);
}
EXPORT_SYMBOL(mount_single);
int get_sb_single(struct file_system_type *fs_type,
int flags, void *data,
int (*fill_super)(struct super_block *, void *, int),
struct vfsmount *mnt)
{
struct dentry *root;
root = mount_single(fs_type, flags, data, fill_super);
if (IS_ERR(root))
return PTR_ERR(root);
mnt->mnt_root = root;
mnt->mnt_sb = root->d_sb;
return 0; return 0;
} }
@ -918,6 +956,7 @@ struct vfsmount *
vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data) vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data)
{ {
struct vfsmount *mnt; struct vfsmount *mnt;
struct dentry *root;
char *secdata = NULL; char *secdata = NULL;
int error; int error;
@ -942,9 +981,19 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
goto out_free_secdata; goto out_free_secdata;
} }
error = type->get_sb(type, flags, name, data, mnt); if (type->mount) {
if (error < 0) root = type->mount(type, flags, name, data);
goto out_free_secdata; if (IS_ERR(root)) {
error = PTR_ERR(root);
goto out_free_secdata;
}
mnt->mnt_root = root;
mnt->mnt_sb = root->d_sb;
} else {
error = type->get_sb(type, flags, name, data, mnt);
if (error < 0)
goto out_free_secdata;
}
BUG_ON(!mnt->mnt_sb); BUG_ON(!mnt->mnt_sb);
WARN_ON(!mnt->mnt_sb->s_bdi); WARN_ON(!mnt->mnt_sb->s_bdi);
mnt->mnt_sb->s_flags |= MS_BORN; mnt->mnt_sb->s_flags |= MS_BORN;

View File

@ -23,7 +23,7 @@
#include "sysfs.h" #include "sysfs.h"
static struct vfsmount *sysfs_mount; static struct vfsmount *sysfs_mnt;
struct kmem_cache *sysfs_dir_cachep; struct kmem_cache *sysfs_dir_cachep;
static const struct super_operations sysfs_ops = { static const struct super_operations sysfs_ops = {
@ -95,18 +95,17 @@ static int sysfs_set_super(struct super_block *sb, void *data)
return error; return error;
} }
static int sysfs_get_sb(struct file_system_type *fs_type, static struct dentry *sysfs_mount(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 sysfs_super_info *info; struct sysfs_super_info *info;
enum kobj_ns_type type; enum kobj_ns_type type;
struct super_block *sb; struct super_block *sb;
int error; int error;
error = -ENOMEM;
info = kzalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) if (!info)
goto out; return ERR_PTR(-ENOMEM);
for (type = KOBJ_NS_TYPE_NONE; type < KOBJ_NS_TYPES; type++) for (type = KOBJ_NS_TYPE_NONE; type < KOBJ_NS_TYPES; type++)
info->ns[type] = kobj_ns_current(type); info->ns[type] = kobj_ns_current(type);
@ -114,24 +113,19 @@ static int sysfs_get_sb(struct file_system_type *fs_type,
sb = sget(fs_type, sysfs_test_super, sysfs_set_super, info); sb = sget(fs_type, sysfs_test_super, sysfs_set_super, info);
if (IS_ERR(sb) || sb->s_fs_info != info) if (IS_ERR(sb) || sb->s_fs_info != info)
kfree(info); kfree(info);
if (IS_ERR(sb)) { if (IS_ERR(sb))
error = PTR_ERR(sb); return ERR_CAST(sb);
goto out;
}
if (!sb->s_root) { if (!sb->s_root) {
sb->s_flags = flags; sb->s_flags = flags;
error = sysfs_fill_super(sb, data, flags & MS_SILENT ? 1 : 0); error = sysfs_fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
if (error) { if (error) {
deactivate_locked_super(sb); deactivate_locked_super(sb);
goto out; return ERR_PTR(error);
} }
sb->s_flags |= MS_ACTIVE; sb->s_flags |= MS_ACTIVE;
} }
simple_set_mnt(mnt, sb); return dget(sb->s_root);
error = 0;
out:
return error;
} }
static void sysfs_kill_sb(struct super_block *sb) static void sysfs_kill_sb(struct super_block *sb)
@ -147,7 +141,7 @@ static void sysfs_kill_sb(struct super_block *sb)
static struct file_system_type sysfs_fs_type = { static struct file_system_type sysfs_fs_type = {
.name = "sysfs", .name = "sysfs",
.get_sb = sysfs_get_sb, .mount = sysfs_mount,
.kill_sb = sysfs_kill_sb, .kill_sb = sysfs_kill_sb,
}; };
@ -189,11 +183,11 @@ int __init sysfs_init(void)
err = register_filesystem(&sysfs_fs_type); err = register_filesystem(&sysfs_fs_type);
if (!err) { if (!err) {
sysfs_mount = kern_mount(&sysfs_fs_type); sysfs_mnt = kern_mount(&sysfs_fs_type);
if (IS_ERR(sysfs_mount)) { if (IS_ERR(sysfs_mnt)) {
printk(KERN_ERR "sysfs: could not mount!\n"); printk(KERN_ERR "sysfs: could not mount!\n");
err = PTR_ERR(sysfs_mount); err = PTR_ERR(sysfs_mnt);
sysfs_mount = NULL; sysfs_mnt = NULL;
unregister_filesystem(&sysfs_fs_type); unregister_filesystem(&sysfs_fs_type);
goto out_err; goto out_err;
} }

View File

@ -526,23 +526,22 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent)
/* Every kernel module contains stuff like this. */ /* Every kernel module contains stuff like this. */
static int sysv_get_sb(struct file_system_type *fs_type, static struct dentry *sysv_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, sysv_fill_super, return mount_bdev(fs_type, flags, dev_name, data, sysv_fill_super);
mnt);
} }
static int v7_get_sb(struct file_system_type *fs_type, static struct dentry *v7_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, v7_fill_super, mnt); return mount_bdev(fs_type, flags, dev_name, data, v7_fill_super);
} }
static struct file_system_type sysv_fs_type = { static struct file_system_type sysv_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "sysv", .name = "sysv",
.get_sb = sysv_get_sb, .mount = sysv_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };
@ -550,7 +549,7 @@ static struct file_system_type sysv_fs_type = {
static struct file_system_type v7_fs_type = { static struct file_system_type v7_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "v7", .name = "v7",
.get_sb = v7_get_sb, .mount = v7_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -2038,8 +2038,8 @@ static int sb_test(struct super_block *sb, void *data)
return c->vi.cdev == *dev; return c->vi.cdev == *dev;
} }
static int ubifs_get_sb(struct file_system_type *fs_type, int flags, static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
const char *name, void *data, struct vfsmount *mnt) const char *name, void *data)
{ {
struct ubi_volume_desc *ubi; struct ubi_volume_desc *ubi;
struct ubi_volume_info vi; struct ubi_volume_info vi;
@ -2057,7 +2057,7 @@ static int ubifs_get_sb(struct file_system_type *fs_type, int flags,
if (IS_ERR(ubi)) { if (IS_ERR(ubi)) {
dbg_err("cannot open \"%s\", error %d", dbg_err("cannot open \"%s\", error %d",
name, (int)PTR_ERR(ubi)); name, (int)PTR_ERR(ubi));
return PTR_ERR(ubi); return ERR_CAST(ubi);
} }
ubi_get_volume_info(ubi, &vi); ubi_get_volume_info(ubi, &vi);
@ -2095,20 +2095,19 @@ static int ubifs_get_sb(struct file_system_type *fs_type, int flags,
/* 'fill_super()' opens ubi again so we must close it here */ /* 'fill_super()' opens ubi again so we must close it here */
ubi_close_volume(ubi); ubi_close_volume(ubi);
simple_set_mnt(mnt, sb); return dget(sb->s_root);
return 0;
out_deact: out_deact:
deactivate_locked_super(sb); deactivate_locked_super(sb);
out_close: out_close:
ubi_close_volume(ubi); ubi_close_volume(ubi);
return err; return ERR_PTR(err);
} }
static struct file_system_type ubifs_fs_type = { static struct file_system_type ubifs_fs_type = {
.name = "ubifs", .name = "ubifs",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.get_sb = ubifs_get_sb, .mount = ubifs_mount,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
}; };

View File

@ -107,17 +107,16 @@ struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi)
} }
/* UDF filesystem type */ /* UDF filesystem type */
static int udf_get_sb(struct file_system_type *fs_type, static struct dentry *udf_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data, int flags, const char *dev_name, void *data)
struct vfsmount *mnt)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, udf_fill_super, mnt); return mount_bdev(fs_type, flags, dev_name, data, udf_fill_super);
} }
static struct file_system_type udf_fstype = { static struct file_system_type udf_fstype = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "udf", .name = "udf",
.get_sb = udf_get_sb, .mount = udf_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -1454,16 +1454,16 @@ static const struct super_operations ufs_super_ops = {
.show_options = ufs_show_options, .show_options = ufs_show_options,
}; };
static int ufs_get_sb(struct file_system_type *fs_type, static struct dentry *ufs_mount(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)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, ufs_fill_super, mnt); return mount_bdev(fs_type, flags, dev_name, data, ufs_fill_super);
} }
static struct file_system_type ufs_fs_type = { static struct file_system_type ufs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ufs", .name = "ufs",
.get_sb = ufs_get_sb, .mount = ufs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -1609,16 +1609,14 @@ xfs_fs_fill_super(
goto out_free_sb; goto out_free_sb;
} }
STATIC int STATIC struct dentry *
xfs_fs_get_sb( xfs_fs_mount(
struct file_system_type *fs_type, struct file_system_type *fs_type,
int flags, int flags,
const char *dev_name, const char *dev_name,
void *data, void *data)
struct vfsmount *mnt)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, xfs_fs_fill_super, return mount_bdev(fs_type, flags, dev_name, data, xfs_fs_fill_super);
mnt);
} }
static const struct super_operations xfs_super_operations = { static const struct super_operations xfs_super_operations = {
@ -1639,7 +1637,7 @@ static const struct super_operations xfs_super_operations = {
static struct file_system_type xfs_fs_type = { static struct file_system_type xfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "xfs", .name = "xfs",
.get_sb = xfs_fs_get_sb, .mount = xfs_fs_mount,
.kill_sb = kill_block_super, .kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };

View File

@ -1772,6 +1772,8 @@ struct file_system_type {
int fs_flags; int fs_flags;
int (*get_sb) (struct file_system_type *, int, int (*get_sb) (struct file_system_type *, int,
const char *, void *, struct vfsmount *); const char *, void *, struct vfsmount *);
struct dentry *(*mount) (struct file_system_type *, int,
const char *, void *);
void (*kill_sb) (struct super_block *); void (*kill_sb) (struct super_block *);
struct module *owner; struct module *owner;
struct file_system_type * next; struct file_system_type * next;
@ -1787,17 +1789,25 @@ struct file_system_type {
struct lock_class_key i_alloc_sem_key; struct lock_class_key i_alloc_sem_key;
}; };
extern int get_sb_ns(struct file_system_type *fs_type, int flags, void *data, extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags,
int (*fill_super)(struct super_block *, void *, int), void *data, int (*fill_super)(struct super_block *, void *, int));
struct vfsmount *mnt); extern struct dentry *mount_bdev(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data,
int (*fill_super)(struct super_block *, void *, int));
extern int get_sb_bdev(struct file_system_type *fs_type, extern int get_sb_bdev(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data, int flags, const char *dev_name, void *data,
int (*fill_super)(struct super_block *, void *, int), int (*fill_super)(struct super_block *, void *, int),
struct vfsmount *mnt); struct vfsmount *mnt);
extern struct dentry *mount_single(struct file_system_type *fs_type,
int flags, void *data,
int (*fill_super)(struct super_block *, void *, int));
extern int get_sb_single(struct file_system_type *fs_type, extern int get_sb_single(struct file_system_type *fs_type,
int flags, void *data, int flags, void *data,
int (*fill_super)(struct super_block *, void *, int), int (*fill_super)(struct super_block *, void *, int),
struct vfsmount *mnt); struct vfsmount *mnt);
extern struct dentry *mount_nodev(struct file_system_type *fs_type,
int flags, void *data,
int (*fill_super)(struct super_block *, void *, int));
extern int get_sb_nodev(struct file_system_type *fs_type, extern int get_sb_nodev(struct file_system_type *fs_type,
int flags, void *data, int flags, void *data,
int (*fill_super)(struct super_block *, void *, int), int (*fill_super)(struct super_block *, void *, int),
@ -1813,9 +1823,8 @@ struct super_block *sget(struct file_system_type *type,
int (*test)(struct super_block *,void *), int (*test)(struct super_block *,void *),
int (*set)(struct super_block *,void *), int (*set)(struct super_block *,void *),
void *data); void *data);
extern int get_sb_pseudo(struct file_system_type *, char *, extern struct dentry *mount_pseudo(struct file_system_type *, char *,
const struct super_operations *ops, unsigned long, const struct super_operations *ops, unsigned long);
struct vfsmount *mnt);
extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
static inline void sb_mark_dirty(struct super_block *sb) static inline void sb_mark_dirty(struct super_block *sb)

View File

@ -18,10 +18,9 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/mount.h> #include <linux/mount.h>
extern int get_sb_mtd(struct file_system_type *fs_type, int flags, extern struct dentry *mount_mtd(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, const char *dev_name, void *data,
int (*fill_super)(struct super_block *, void *, int), int (*fill_super)(struct super_block *, void *, int));
struct vfsmount *mnt);
extern void kill_mtd_super(struct super_block *sb); extern void kill_mtd_super(struct super_block *sb);

View File

@ -3,8 +3,8 @@
struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir, struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir,
int mode, dev_t dev); int mode, dev_t dev);
extern int ramfs_get_sb(struct file_system_type *fs_type, extern struct dentry *ramfs_mount(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);
#ifndef CONFIG_MMU #ifndef CONFIG_MMU
extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize); extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize);

View File

@ -211,13 +211,13 @@ static int mqueue_fill_super(struct super_block *sb, void *data, int silent)
return error; return error;
} }
static int mqueue_get_sb(struct file_system_type *fs_type, static struct dentry *mqueue_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
if (!(flags & MS_KERNMOUNT)) if (!(flags & MS_KERNMOUNT))
data = current->nsproxy->ipc_ns; data = current->nsproxy->ipc_ns;
return get_sb_ns(fs_type, flags, data, mqueue_fill_super, mnt); return mount_ns(fs_type, flags, data, mqueue_fill_super);
} }
static void init_once(void *foo) static void init_once(void *foo)
@ -1232,7 +1232,7 @@ static const struct super_operations mqueue_super_ops = {
static struct file_system_type mqueue_fs_type = { static struct file_system_type mqueue_fs_type = {
.name = "mqueue", .name = "mqueue",
.get_sb = mqueue_get_sb, .mount = mqueue_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

View File

@ -1460,9 +1460,9 @@ static int cgroup_get_rootdir(struct super_block *sb)
return 0; return 0;
} }
static int cgroup_get_sb(struct file_system_type *fs_type, static struct dentry *cgroup_mount(struct file_system_type *fs_type,
int flags, const char *unused_dev_name, int flags, const char *unused_dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
struct cgroup_sb_opts opts; struct cgroup_sb_opts opts;
struct cgroupfs_root *root; struct cgroupfs_root *root;
@ -1596,10 +1596,9 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
drop_parsed_module_refcounts(opts.subsys_bits); drop_parsed_module_refcounts(opts.subsys_bits);
} }
simple_set_mnt(mnt, sb);
kfree(opts.release_agent); kfree(opts.release_agent);
kfree(opts.name); kfree(opts.name);
return 0; return dget(sb->s_root);
drop_new_super: drop_new_super:
deactivate_locked_super(sb); deactivate_locked_super(sb);
@ -1608,7 +1607,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);
return ret; return ERR_PTR(ret);
} }
static void cgroup_kill_sb(struct super_block *sb) { static void cgroup_kill_sb(struct super_block *sb) {
@ -1658,7 +1657,7 @@ static void cgroup_kill_sb(struct super_block *sb) {
static struct file_system_type cgroup_fs_type = { static struct file_system_type cgroup_fs_type = {
.name = "cgroup", .name = "cgroup",
.get_sb = cgroup_get_sb, .mount = cgroup_mount,
.kill_sb = cgroup_kill_sb, .kill_sb = cgroup_kill_sb,
}; };

View File

@ -231,18 +231,17 @@ static DEFINE_SPINLOCK(cpuset_buffer_lock);
* users. If someone tries to mount the "cpuset" filesystem, we * users. If someone tries to mount the "cpuset" filesystem, we
* silently switch it to mount "cgroup" instead * silently switch it to mount "cgroup" instead
*/ */
static int cpuset_get_sb(struct file_system_type *fs_type, static struct dentry *cpuset_mount(struct file_system_type *fs_type,
int flags, const char *unused_dev_name, int flags, const char *unused_dev_name, void *data)
void *data, struct vfsmount *mnt)
{ {
struct file_system_type *cgroup_fs = get_fs_type("cgroup"); struct file_system_type *cgroup_fs = get_fs_type("cgroup");
int ret = -ENODEV; struct dentry *ret = ERR_PTR(-ENODEV);
if (cgroup_fs) { if (cgroup_fs) {
char mountopts[] = char mountopts[] =
"cpuset,noprefix," "cpuset,noprefix,"
"release_agent=/sbin/cpuset_release_agent"; "release_agent=/sbin/cpuset_release_agent";
ret = cgroup_fs->get_sb(cgroup_fs, flags, ret = cgroup_fs->mount(cgroup_fs, flags,
unused_dev_name, mountopts, mnt); unused_dev_name, mountopts);
put_filesystem(cgroup_fs); put_filesystem(cgroup_fs);
} }
return ret; return ret;
@ -250,7 +249,7 @@ static int cpuset_get_sb(struct file_system_type *fs_type,
static struct file_system_type cpuset_fs_type = { static struct file_system_type cpuset_fs_type = {
.name = "cpuset", .name = "cpuset",
.get_sb = cpuset_get_sb, .mount = cpuset_mount,
}; };
/* /*

View File

@ -2538,16 +2538,16 @@ static const struct vm_operations_struct shmem_vm_ops = {
}; };
static int shmem_get_sb(struct file_system_type *fs_type, static struct dentry *shmem_mount(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)
{ {
return get_sb_nodev(fs_type, flags, data, shmem_fill_super, mnt); return mount_nodev(fs_type, flags, data, shmem_fill_super);
} }
static struct file_system_type tmpfs_fs_type = { static struct file_system_type tmpfs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "tmpfs", .name = "tmpfs",
.get_sb = shmem_get_sb, .mount = shmem_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };
@ -2643,7 +2643,7 @@ void mem_cgroup_get_shmem_target(struct inode *inode, pgoff_t pgoff,
static struct file_system_type tmpfs_fs_type = { static struct file_system_type tmpfs_fs_type = {
.name = "tmpfs", .name = "tmpfs",
.get_sb = ramfs_get_sb, .mount = ramfs_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

View File

@ -305,19 +305,17 @@ static const struct super_operations sockfs_ops = {
.statfs = simple_statfs, .statfs = simple_statfs,
}; };
static int sockfs_get_sb(struct file_system_type *fs_type, static struct dentry *sockfs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data, int flags, const char *dev_name, void *data)
struct vfsmount *mnt)
{ {
return get_sb_pseudo(fs_type, "socket:", &sockfs_ops, SOCKFS_MAGIC, return mount_pseudo(fs_type, "socket:", &sockfs_ops, SOCKFS_MAGIC);
mnt);
} }
static struct vfsmount *sock_mnt __read_mostly; static struct vfsmount *sock_mnt __read_mostly;
static struct file_system_type sock_fs_type = { static struct file_system_type sock_fs_type = {
.name = "sockfs", .name = "sockfs",
.get_sb = sockfs_get_sb, .mount = sockfs_mount,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
}; };

View File

@ -28,7 +28,7 @@
#include <linux/sunrpc/rpc_pipe_fs.h> #include <linux/sunrpc/rpc_pipe_fs.h>
#include <linux/sunrpc/cache.h> #include <linux/sunrpc/cache.h>
static struct vfsmount *rpc_mount __read_mostly; static struct vfsmount *rpc_mnt __read_mostly;
static int rpc_mount_count; static int rpc_mount_count;
static struct file_system_type rpc_pipe_fs_type; static struct file_system_type rpc_pipe_fs_type;
@ -417,16 +417,16 @@ struct vfsmount *rpc_get_mount(void)
{ {
int err; int err;
err = simple_pin_fs(&rpc_pipe_fs_type, &rpc_mount, &rpc_mount_count); err = simple_pin_fs(&rpc_pipe_fs_type, &rpc_mnt, &rpc_mount_count);
if (err != 0) if (err != 0)
return ERR_PTR(err); return ERR_PTR(err);
return rpc_mount; return rpc_mnt;
} }
EXPORT_SYMBOL_GPL(rpc_get_mount); EXPORT_SYMBOL_GPL(rpc_get_mount);
void rpc_put_mount(void) void rpc_put_mount(void)
{ {
simple_release_fs(&rpc_mount, &rpc_mount_count); simple_release_fs(&rpc_mnt, &rpc_mount_count);
} }
EXPORT_SYMBOL_GPL(rpc_put_mount); EXPORT_SYMBOL_GPL(rpc_put_mount);
@ -1018,17 +1018,17 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
return 0; return 0;
} }
static int static struct dentry *
rpc_get_sb(struct file_system_type *fs_type, rpc_mount(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)
{ {
return get_sb_single(fs_type, flags, data, rpc_fill_super, mnt); return mount_single(fs_type, flags, data, rpc_fill_super);
} }
static struct file_system_type rpc_pipe_fs_type = { static struct file_system_type rpc_pipe_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "rpc_pipefs", .name = "rpc_pipefs",
.get_sb = rpc_get_sb, .mount = rpc_mount,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

View File

@ -131,17 +131,17 @@ static int fill_super(struct super_block *sb, void *data, int silent)
return simple_fill_super(sb, SECURITYFS_MAGIC, files); return simple_fill_super(sb, SECURITYFS_MAGIC, files);
} }
static int get_sb(struct file_system_type *fs_type, static struct dentry *get_sb(struct file_system_type *fs_type,
int flags, const char *dev_name, int flags, const char *dev_name,
void *data, struct vfsmount *mnt) void *data)
{ {
return get_sb_single(fs_type, flags, data, fill_super, mnt); return mount_single(fs_type, flags, data, fill_super);
} }
static struct file_system_type fs_type = { static struct file_system_type fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "securityfs", .name = "securityfs",
.get_sb = get_sb, .mount = get_sb,
.kill_sb = kill_litter_super, .kill_sb = kill_litter_super,
}; };

Some files were not shown because too many files have changed in this diff Show More