summaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2019-03-25 12:38:28 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2019-05-25 17:59:56 -0400
commitb9662f3103546005b9cc01862bb1031fe5e99ff9 (patch)
tree80601bb05d350b38d8c3eaa1bb98ce0bcb9908c2 /net/sunrpc
parent0ce0cf12fc4c6a089717ff613d76457052cf4303 (diff)
vfs: Convert rpc_pipefs to use the new mount API
Convert the rpc_pipefs filesystem to the new internal mount API as the old one will be obsoleted and removed. This allows greater flexibility in communication of mount parameters between userspace, the VFS and the filesystem. See Documentation/filesystems/mount_api.txt for more information. Signed-off-by: David Howells <dhowells@redhat.com> cc: Trond Myklebust <trond.myklebust@hammerspace.com> cc: Anna Schumaker <anna.schumaker@netapp.com> cc: "J. Bruce Fields" <bfields@fieldses.org> cc: Jeff Layton <jlayton@kernel.org> cc: linux-nfs@vger.kernel.org
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/rpc_pipe.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 979d23646e33..0b6c27cd6bde 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -13,6 +13,7 @@
13#include <linux/string.h> 13#include <linux/string.h>
14#include <linux/pagemap.h> 14#include <linux/pagemap.h>
15#include <linux/mount.h> 15#include <linux/mount.h>
16#include <linux/fs_context.h>
16#include <linux/namei.h> 17#include <linux/namei.h>
17#include <linux/fsnotify.h> 18#include <linux/fsnotify.h>
18#include <linux/kernel.h> 19#include <linux/kernel.h>
@@ -1347,11 +1348,11 @@ rpc_gssd_dummy_depopulate(struct dentry *pipe_dentry)
1347} 1348}
1348 1349
1349static int 1350static int
1350rpc_fill_super(struct super_block *sb, void *data, int silent) 1351rpc_fill_super(struct super_block *sb, struct fs_context *fc)
1351{ 1352{
1352 struct inode *inode; 1353 struct inode *inode;
1353 struct dentry *root, *gssd_dentry; 1354 struct dentry *root, *gssd_dentry;
1354 struct net *net = get_net(sb->s_fs_info); 1355 struct net *net = sb->s_fs_info;
1355 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); 1356 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
1356 int err; 1357 int err;
1357 1358
@@ -1408,12 +1409,29 @@ gssd_running(struct net *net)
1408} 1409}
1409EXPORT_SYMBOL_GPL(gssd_running); 1410EXPORT_SYMBOL_GPL(gssd_running);
1410 1411
1411static struct dentry * 1412static int rpc_fs_get_tree(struct fs_context *fc)
1412rpc_mount(struct file_system_type *fs_type, 1413{
1413 int flags, const char *dev_name, void *data) 1414 fc->s_fs_info = get_net(fc->net_ns);
1415 return vfs_get_super(fc, vfs_get_keyed_super, rpc_fill_super);
1416}
1417
1418static void rpc_fs_free_fc(struct fs_context *fc)
1414{ 1419{
1415 struct net *net = current->nsproxy->net_ns; 1420 if (fc->s_fs_info)
1416 return mount_ns(fs_type, flags, data, net, net->user_ns, rpc_fill_super); 1421 put_net(fc->s_fs_info);
1422}
1423
1424static const struct fs_context_operations rpc_fs_context_ops = {
1425 .free = rpc_fs_free_fc,
1426 .get_tree = rpc_fs_get_tree,
1427};
1428
1429static int rpc_init_fs_context(struct fs_context *fc)
1430{
1431 put_user_ns(fc->user_ns);
1432 fc->user_ns = get_user_ns(fc->net_ns->user_ns);
1433 fc->ops = &rpc_fs_context_ops;
1434 return 0;
1417} 1435}
1418 1436
1419static void rpc_kill_sb(struct super_block *sb) 1437static void rpc_kill_sb(struct super_block *sb)
@@ -1441,7 +1459,7 @@ out:
1441static struct file_system_type rpc_pipe_fs_type = { 1459static struct file_system_type rpc_pipe_fs_type = {
1442 .owner = THIS_MODULE, 1460 .owner = THIS_MODULE,
1443 .name = "rpc_pipefs", 1461 .name = "rpc_pipefs",
1444 .mount = rpc_mount, 1462 .init_fs_context = rpc_init_fs_context,
1445 .kill_sb = rpc_kill_sb, 1463 .kill_sb = rpc_kill_sb,
1446}; 1464};
1447MODULE_ALIAS_FS("rpc_pipefs"); 1465MODULE_ALIAS_FS("rpc_pipefs");