@@ -60,8 +60,8 @@ extern void rpc_remove_cache_dir(struct dentry *);
extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *,
const struct rpc_pipe_ops *, int flags);
extern int rpc_unlink(struct dentry *);
-extern struct vfsmount *rpc_get_mount(void);
-extern void rpc_put_mount(void);
+extern struct vfsmount *rpc_get_mount(struct net *net);
+extern void rpc_put_mount(struct net *net);
extern int register_rpc_pipefs(void);
extern void unregister_rpc_pipefs(void);
@@ -9,6 +9,9 @@ struct cache_detail;
struct sunrpc_net {
struct proc_dir_entry *proc_net_rpc;
struct cache_detail *ip_map_cache;
+
+ struct vfsmount *rpc_mnt;
+ int rpc_mount_count;
};
extern int sunrpc_net_id;
@@ -28,8 +28,7 @@
#include <linux/sunrpc/rpc_pipe_fs.h>
#include <linux/sunrpc/cache.h>
-static struct vfsmount *rpc_mnt __read_mostly;
-static int rpc_mount_count;
+#include "netns.h"
static struct file_system_type rpc_pipe_fs_type;
@@ -421,20 +420,28 @@ struct rpc_filelist {
umode_t mode;
};
-struct vfsmount *rpc_get_mount(void)
+struct vfsmount *rpc_get_mount(struct net *net)
{
int err;
+ struct sunrpc_net *sn;
- err = simple_pin_fs(&rpc_pipe_fs_type, &rpc_mnt, &rpc_mount_count);
- if (err != 0)
+ sn = net_generic(get_net(net), sunrpc_net_id);
+ err = simple_pin_fs(&rpc_pipe_fs_type, &sn->rpc_mnt, &sn->rpc_mount_count);
+ if (err != 0) {
+ put_net(net);
return ERR_PTR(err);
- return rpc_mnt;
+ }
+ return sn->rpc_mnt;
}
EXPORT_SYMBOL_GPL(rpc_get_mount);
-void rpc_put_mount(void)
+void rpc_put_mount(struct net *net)
{
- simple_release_fs(&rpc_mnt, &rpc_mount_count);
+ struct sunrpc_net *sn;
+
+ sn = net_generic(net, sunrpc_net_id);
+ simple_release_fs(&sn->rpc_mnt, &sn->rpc_mount_count);
+ put_net(net);
}
EXPORT_SYMBOL_GPL(rpc_put_mount);
This is another part of RPC layer virtualization. RPC pipefs inner data was attached to per-net sunrpc_net instance. Network namespace counter is increased and decreased with every RPC mount reference. This is not hardly requred from my pow, but it looks safer since we relay on network namespace presence. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> --- include/linux/sunrpc/rpc_pipe_fs.h | 4 ++-- net/sunrpc/netns.h | 3 +++ net/sunrpc/rpc_pipe.c | 23 +++++++++++++++-------- 3 files changed, 20 insertions(+), 10 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html