All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] SUNRPC: pipefs virtualization
@ 2011-09-12 14:19 Stanislav Kinsbursky
  2011-09-12 14:19 ` [PATCH 1/2] SUNRPC: make rpc pipefs mount per network namespace Stanislav Kinsbursky
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Stanislav Kinsbursky @ 2011-09-12 14:19 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, bfields, davem

This patch set is a part of further RPC layer virtualization and it's aim is to
make RPC pipefs mount creation and destruction per network namespace context.
It moves RPC pipefs internal data to sunrpc_net instance of network namespace
context.
With this patch set all calls to pipefs infrastructure are performed with
"&init_net" except rpc_new_client() and rpc_setup_pipedir() functions (but they
still passes pointer to "init_net" by current design).
This "init_net" pointer will be replaced later with NFS virtualization.

The following series consists of:

---

Stanislav Kinsbursky (2):
      SUNRPC: make rpc pipefs mount per network namespace
      SUNRPC: RPC pipefs virtualization


 fs/nfs/blocklayout/blocklayout.c   |    2 +-
 fs/nfs/cache_lib.c                 |    7 ++++---
 include/linux/sunrpc/rpc_pipe_fs.h |    4 ++--
 net/sunrpc/clnt.c                  |    8 ++++----
 net/sunrpc/netns.h                 |    3 +++
 net/sunrpc/rpc_pipe.c              |   23 +++++++++++++++--------
 6 files changed, 29 insertions(+), 18 deletions(-)

-- 
Signature

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] SUNRPC: make rpc pipefs mount per network namespace
  2011-09-12 14:19 [PATCH 0/2] SUNRPC: pipefs virtualization Stanislav Kinsbursky
@ 2011-09-12 14:19 ` Stanislav Kinsbursky
  2011-09-12 14:19 ` [PATCH 2/2] SUNRPC: RPC pipefs virtualization Stanislav Kinsbursky
  2011-09-20 12:13   ` Stanislav Kinsbursky
  2 siblings, 0 replies; 5+ messages in thread
From: Stanislav Kinsbursky @ 2011-09-12 14:19 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, bfields, davem

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(-)

diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index cf14db9..0bdf178 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -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);
 
diff --git a/net/sunrpc/netns.h b/net/sunrpc/netns.h
index d013bf2..e45fdf0 100644
--- a/net/sunrpc/netns.h
+++ b/net/sunrpc/netns.h
@@ -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;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index b181e34..ebc5e1c 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -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);
 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] SUNRPC: RPC pipefs virtualization
  2011-09-12 14:19 [PATCH 0/2] SUNRPC: pipefs virtualization Stanislav Kinsbursky
  2011-09-12 14:19 ` [PATCH 1/2] SUNRPC: make rpc pipefs mount per network namespace Stanislav Kinsbursky
@ 2011-09-12 14:19 ` Stanislav Kinsbursky
  2011-09-20 12:13   ` Stanislav Kinsbursky
  2 siblings, 0 replies; 5+ messages in thread
From: Stanislav Kinsbursky @ 2011-09-12 14:19 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, bfields, davem

Parametrize rpc_mount_get() and rpc_mount_put() with network namespace pointer.
Currently init_net is used, but later proper network context will be used
instead.
It actually means, that in future NFS cache have to be virtualied as well.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>

---
 fs/nfs/blocklayout/blocklayout.c |    2 +-
 fs/nfs/cache_lib.c               |    7 ++++---
 net/sunrpc/clnt.c                |    8 ++++----
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index 9561c8f..9904e70 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -979,7 +979,7 @@ static int __init nfs4blocklayout_init(void)
 
 	init_waitqueue_head(&bl_wq);
 
-	mnt = rpc_get_mount();
+	mnt = rpc_get_mount(&init_net);
 	if (IS_ERR(mnt)) {
 		ret = PTR_ERR(mnt);
 		goto out_remove;
diff --git a/fs/nfs/cache_lib.c b/fs/nfs/cache_lib.c
index c98b439..777514b 100644
--- a/fs/nfs/cache_lib.c
+++ b/fs/nfs/cache_lib.c
@@ -11,6 +11,7 @@
 #include <linux/mount.h>
 #include <linux/namei.h>
 #include <linux/slab.h>
+#include <net/net_namespace.h>
 #include <linux/sunrpc/cache.h>
 #include <linux/sunrpc/rpc_pipe_fs.h>
 
@@ -117,7 +118,7 @@ int nfs_cache_register(struct cache_detail *cd)
 	struct path path;
 	int ret;
 
-	mnt = rpc_get_mount();
+	mnt = rpc_get_mount(&init_net);
 	if (IS_ERR(mnt))
 		return PTR_ERR(mnt);
 	ret = vfs_path_lookup(mnt->mnt_root, mnt, "/cache", 0, &path);
@@ -128,13 +129,13 @@ int nfs_cache_register(struct cache_detail *cd)
 	if (!ret)
 		return ret;
 err:
-	rpc_put_mount();
+	rpc_put_mount(&init_net);
 	return ret;
 }
 
 void nfs_cache_unregister(struct cache_detail *cd)
 {
 	sunrpc_cache_unregister_pipefs(cd);
-	rpc_put_mount();
+	rpc_put_mount(&init_net);
 }
 
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index c5347d2..4bebcc0 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -109,7 +109,7 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name)
 	if (dir_name == NULL)
 		return 0;
 
-	path.mnt = rpc_get_mount();
+	path.mnt = rpc_get_mount(clnt->cl_xprt->xprt_net);
 	if (IS_ERR(path.mnt))
 		return PTR_ERR(path.mnt);
 	error = vfs_path_lookup(path.mnt->mnt_root, path.mnt, dir_name, 0, &dir);
@@ -137,7 +137,7 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name)
 err_path_put:
 	path_put(&dir);
 err:
-	rpc_put_mount();
+	rpc_put_mount(clnt->cl_xprt->xprt_net);
 	return error;
 }
 
@@ -248,7 +248,7 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru
 out_no_auth:
 	if (!IS_ERR(clnt->cl_path.dentry)) {
 		rpc_remove_client_dir(clnt->cl_path.dentry);
-		rpc_put_mount();
+		rpc_put_mount(clnt->cl_xprt->xprt_net);
 	}
 out_no_path:
 	kfree(clnt->cl_principal);
@@ -476,7 +476,7 @@ rpc_free_client(struct rpc_clnt *clnt)
 			clnt->cl_protname, clnt->cl_server);
 	if (!IS_ERR(clnt->cl_path.dentry)) {
 		rpc_remove_client_dir(clnt->cl_path.dentry);
-		rpc_put_mount();
+		rpc_put_mount(clnt->cl_xprt->xprt_net);
 	}
 	if (clnt->cl_parent != clnt) {
 		rpc_release_client(clnt->cl_parent);


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] SUNRPC: pipefs virtualization
@ 2011-09-20 12:13   ` Stanislav Kinsbursky
  0 siblings, 0 replies; 5+ messages in thread
From: Stanislav Kinsbursky @ 2011-09-20 12:13 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, Pavel Emelianov, neilb, netdev, linux-kernel, bfields, davem

Probably, holding mount point of network namespace is not a good solution.
There is another one. But I really hope for discussion of it.

RPC pipefs can be virtualized in the way like sysfs done.
But the main problem here is that currently we have only one RPC pipefs mount 
point (superblock, root) for all.
New mount point can be created per every pipefs mount call. We can even have 
some shared privates on dentries with the same name, like sysfs does (but I 
don't see any good reason for this).
But with many mount points we have a problem with RPC pipes creation. I.e. we 
have to find proper mount point for current network namespace, which is required 
for vfs_path_lookup(), which is done prior to pipe creation.
And thus we have to store this per-netns mount points somewhere. It could be 
some static variable. But we have to implement search function for them.
This approach can hide all pipefs virtualization from it's users. But it's still 
look ugly from my pow.

Maybe, somebody have suggest better solution for this problem?

12.09.2011 18:19, Stanislav Kinsbursky пишет:
> This patch set is a part of further RPC layer virtualization and it's aim is to
> make RPC pipefs mount creation and destruction per network namespace context.
> It moves RPC pipefs internal data to sunrpc_net instance of network namespace
> context.
> With this patch set all calls to pipefs infrastructure are performed with
> "&init_net" except rpc_new_client() and rpc_setup_pipedir() functions (but they
> still passes pointer to "init_net" by current design).
> This "init_net" pointer will be replaced later with NFS virtualization.
>
> The following series consists of:
>
> ---
>
> Stanislav Kinsbursky (2):
>        SUNRPC: make rpc pipefs mount per network namespace
>        SUNRPC: RPC pipefs virtualization
>
>
>   fs/nfs/blocklayout/blocklayout.c   |    2 +-
>   fs/nfs/cache_lib.c                 |    7 ++++---
>   include/linux/sunrpc/rpc_pipe_fs.h |    4 ++--
>   net/sunrpc/clnt.c                  |    8 ++++----
>   net/sunrpc/netns.h                 |    3 +++
>   net/sunrpc/rpc_pipe.c              |   23 +++++++++++++++--------
>   6 files changed, 29 insertions(+), 18 deletions(-)
>


-- 
Best regards,
Stanislav Kinsbursky

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] SUNRPC: pipefs virtualization
@ 2011-09-20 12:13   ` Stanislav Kinsbursky
  0 siblings, 0 replies; 5+ messages in thread
From: Stanislav Kinsbursky @ 2011-09-20 12:13 UTC (permalink / raw)
  To: Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA
  Cc: linux-nfs-u79uwXL29TY76Z2rM5mHXA, Pavel Emelianov,
	neilb-l3A5Bk7waGM, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	bfields-uC3wQj2KruNg9hUCZPvPmw, davem-fT/PcQaiUtIeIZ0/mPfg9Q

Probably, holding mount point of network namespace is not a good solution.
There is another one. But I really hope for discussion of it.

RPC pipefs can be virtualized in the way like sysfs done.
But the main problem here is that currently we have only one RPC pipefs mount 
point (superblock, root) for all.
New mount point can be created per every pipefs mount call. We can even have 
some shared privates on dentries with the same name, like sysfs does (but I 
don't see any good reason for this).
But with many mount points we have a problem with RPC pipes creation. I.e. we 
have to find proper mount point for current network namespace, which is required 
for vfs_path_lookup(), which is done prior to pipe creation.
And thus we have to store this per-netns mount points somewhere. It could be 
some static variable. But we have to implement search function for them.
This approach can hide all pipefs virtualization from it's users. But it's still 
look ugly from my pow.

Maybe, somebody have suggest better solution for this problem?

12.09.2011 18:19, Stanislav Kinsbursky пишет:
> This patch set is a part of further RPC layer virtualization and it's aim is to
> make RPC pipefs mount creation and destruction per network namespace context.
> It moves RPC pipefs internal data to sunrpc_net instance of network namespace
> context.
> With this patch set all calls to pipefs infrastructure are performed with
> "&init_net" except rpc_new_client() and rpc_setup_pipedir() functions (but they
> still passes pointer to "init_net" by current design).
> This "init_net" pointer will be replaced later with NFS virtualization.
>
> The following series consists of:
>
> ---
>
> Stanislav Kinsbursky (2):
>        SUNRPC: make rpc pipefs mount per network namespace
>        SUNRPC: RPC pipefs virtualization
>
>
>   fs/nfs/blocklayout/blocklayout.c   |    2 +-
>   fs/nfs/cache_lib.c                 |    7 ++++---
>   include/linux/sunrpc/rpc_pipe_fs.h |    4 ++--
>   net/sunrpc/clnt.c                  |    8 ++++----
>   net/sunrpc/netns.h                 |    3 +++
>   net/sunrpc/rpc_pipe.c              |   23 +++++++++++++++--------
>   6 files changed, 29 insertions(+), 18 deletions(-)
>


-- 
Best regards,
Stanislav Kinsbursky
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-09-20 12:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-12 14:19 [PATCH 0/2] SUNRPC: pipefs virtualization Stanislav Kinsbursky
2011-09-12 14:19 ` [PATCH 1/2] SUNRPC: make rpc pipefs mount per network namespace Stanislav Kinsbursky
2011-09-12 14:19 ` [PATCH 2/2] SUNRPC: RPC pipefs virtualization Stanislav Kinsbursky
2011-09-20 12:13 ` [PATCH 0/2] SUNRPC: " Stanislav Kinsbursky
2011-09-20 12:13   ` Stanislav Kinsbursky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.