Merge branch 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs mount infrastructure updates from Al Viro: "The rest of core infrastructure; no new syscalls in that pile, but the old parts are switched to new infrastructure. At that point conversions of individual filesystems can happen independently; some are done here (afs, cgroup, procfs, etc.), there's also a large series outside of that pile dealing with NFS (quite a bit of option-parsing stuff is getting used there - it's one of the most convoluted filesystems in terms of mount-related logics), but NFS bits are the next cycle fodder. It got seriously simplified since the last cycle; documentation is probably the weakest bit at the moment - I considered dropping the commit introducing Documentation/filesystems/mount_api.txt (cutting the size increase by quarter ;-), but decided that it would be better to fix it up after -rc1 instead. That pile allows to do followup work in independent branches, which should make life much easier for the next cycle. fs/super.c size increase is unpleasant; there's a followup series that allows to shrink it considerably, but I decided to leave that until the next cycle" * 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (41 commits) afs: Use fs_context to pass parameters over automount afs: Add fs_context support vfs: Add some logging to the core users of the fs_context log vfs: Implement logging through fs_context vfs: Provide documentation for new mount API vfs: Remove kern_mount_data() hugetlbfs: Convert to fs_context cpuset: Use fs_context kernfs, sysfs, cgroup, intel_rdt: Support fs_context cgroup: store a reference to cgroup_ns into cgroup_fs_context cgroup1_get_tree(): separate "get cgroup_root to use" into a separate helper cgroup_do_mount(): massage calling conventions cgroup: stash cgroup_root reference into cgroup_fs_context cgroup2: switch to option-by-option parsing cgroup1: switch to option-by-option parsing cgroup: take options parsing into ->parse_monolithic() cgroup: fold cgroup1_mount() into cgroup1_get_tree() cgroup: start switching to fs_context ipc: Convert mqueue fs to fs_context proc: Add fs_context support to procfs ...
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include <linux/memory.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/mount.h>
|
||||
#include <linux/fs_context.h>
|
||||
#include <linux/namei.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/proc_fs.h>
|
||||
@@ -359,25 +360,52 @@ static inline bool is_in_v2_mode(void)
|
||||
* users. If someone tries to mount the "cpuset" filesystem, we
|
||||
* silently switch it to mount "cgroup" instead
|
||||
*/
|
||||
static struct dentry *cpuset_mount(struct file_system_type *fs_type,
|
||||
int flags, const char *unused_dev_name, void *data)
|
||||
static int cpuset_get_tree(struct fs_context *fc)
|
||||
{
|
||||
struct file_system_type *cgroup_fs = get_fs_type("cgroup");
|
||||
struct dentry *ret = ERR_PTR(-ENODEV);
|
||||
if (cgroup_fs) {
|
||||
char mountopts[] =
|
||||
"cpuset,noprefix,"
|
||||
"release_agent=/sbin/cpuset_release_agent";
|
||||
ret = cgroup_fs->mount(cgroup_fs, flags,
|
||||
unused_dev_name, mountopts);
|
||||
put_filesystem(cgroup_fs);
|
||||
struct file_system_type *cgroup_fs;
|
||||
struct fs_context *new_fc;
|
||||
int ret;
|
||||
|
||||
cgroup_fs = get_fs_type("cgroup");
|
||||
if (!cgroup_fs)
|
||||
return -ENODEV;
|
||||
|
||||
new_fc = fs_context_for_mount(cgroup_fs, fc->sb_flags);
|
||||
if (IS_ERR(new_fc)) {
|
||||
ret = PTR_ERR(new_fc);
|
||||
} else {
|
||||
static const char agent_path[] = "/sbin/cpuset_release_agent";
|
||||
ret = vfs_parse_fs_string(new_fc, "cpuset", NULL, 0);
|
||||
if (!ret)
|
||||
ret = vfs_parse_fs_string(new_fc, "noprefix", NULL, 0);
|
||||
if (!ret)
|
||||
ret = vfs_parse_fs_string(new_fc, "release_agent",
|
||||
agent_path, sizeof(agent_path) - 1);
|
||||
if (!ret)
|
||||
ret = vfs_get_tree(new_fc);
|
||||
if (!ret) { /* steal the result */
|
||||
fc->root = new_fc->root;
|
||||
new_fc->root = NULL;
|
||||
}
|
||||
put_fs_context(new_fc);
|
||||
}
|
||||
put_filesystem(cgroup_fs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct fs_context_operations cpuset_fs_context_ops = {
|
||||
.get_tree = cpuset_get_tree,
|
||||
};
|
||||
|
||||
static int cpuset_init_fs_context(struct fs_context *fc)
|
||||
{
|
||||
fc->ops = &cpuset_fs_context_ops;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct file_system_type cpuset_fs_type = {
|
||||
.name = "cpuset",
|
||||
.mount = cpuset_mount,
|
||||
.name = "cpuset",
|
||||
.init_fs_context = cpuset_init_fs_context,
|
||||
};
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user