aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/rpc_pipe.c
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2011-12-26 07:39:04 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-01-31 18:20:23 -0500
commit021c68dec8c04c44cb82eb5bbee77028fafe22e8 (patch)
treef0444695a2e9579dea0e27e93575d4db40ababc8 /net/sunrpc/rpc_pipe.c
parent38b0da7522c086f1dcdeda39a2d1849c6a31f518 (diff)
SUNRPC: hold current network namespace while pipefs superblock is active
We want to be sure that network namespace is still alive while we have pipefs mounted. This will be required later, when RPC pipefs will be mounting only from user-space context. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/rpc_pipe.c')
-rw-r--r--net/sunrpc/rpc_pipe.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index e32e6b8c006..f628b0f48a8 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -27,6 +27,9 @@
27#include <linux/workqueue.h> 27#include <linux/workqueue.h>
28#include <linux/sunrpc/rpc_pipe_fs.h> 28#include <linux/sunrpc/rpc_pipe_fs.h>
29#include <linux/sunrpc/cache.h> 29#include <linux/sunrpc/cache.h>
30#include <linux/nsproxy.h>
31
32#include "netns.h"
30 33
31static struct vfsmount *rpc_mnt __read_mostly; 34static struct vfsmount *rpc_mnt __read_mostly;
32static int rpc_mount_count; 35static int rpc_mount_count;
@@ -1011,6 +1014,7 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
1011 } 1014 }
1012 if (rpc_populate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF, NULL)) 1015 if (rpc_populate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF, NULL))
1013 return -ENOMEM; 1016 return -ENOMEM;
1017 sb->s_fs_info = get_net(net);
1014 return 0; 1018 return 0;
1015} 1019}
1016 1020
@@ -1021,11 +1025,19 @@ rpc_mount(struct file_system_type *fs_type,
1021 return mount_ns(fs_type, flags, current->nsproxy->net_ns, rpc_fill_super); 1025 return mount_ns(fs_type, flags, current->nsproxy->net_ns, rpc_fill_super);
1022} 1026}
1023 1027
1028void rpc_kill_sb(struct super_block *sb)
1029{
1030 struct net *net = sb->s_fs_info;
1031
1032 put_net(net);
1033 kill_litter_super(sb);
1034}
1035
1024static struct file_system_type rpc_pipe_fs_type = { 1036static struct file_system_type rpc_pipe_fs_type = {
1025 .owner = THIS_MODULE, 1037 .owner = THIS_MODULE,
1026 .name = "rpc_pipefs", 1038 .name = "rpc_pipefs",
1027 .mount = rpc_mount, 1039 .mount = rpc_mount,
1028 .kill_sb = kill_litter_super, 1040 .kill_sb = rpc_kill_sb,
1029}; 1041};
1030 1042
1031static void 1043static void