netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/5] SUNRPC: "RPC pipefs per network namespace" preparations
@ 2011-10-17 13:10 Stanislav Kinsbursky
  2011-10-17 13:10 ` [RFC PATCH 1/5] SUNRPC: hold current network namespace while pipefs superblock is active Stanislav Kinsbursky
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Stanislav Kinsbursky @ 2011-10-17 13:10 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, bfields, davem,
	devel

Hello to everyone. 
RPC pipefs file system have to work per network namespace context is required
prior to any NFS modifications.
This is a way how to do it. I'll really appreciate for any comments.

There are several statements about how to make RPC pipefs working per network
namespace context.
Here they are:
1) RPC pipefs should be mounted per network namespace context.
2) RPC pipefs superblock should holds network namespace while active.
3) RPC pipefs lookup and readir should be perfomed in network namespace context
it was mounted. IOW, user-space process, working in another network namespace
context, should see RPC pipefs dentries from network namespace context this
mount-point was created (like it was done for sysfs). 

These statement leads to some restrictions which we must follow during
implementation. Here are they:
1) RPC pipefs mount can't be performed in kernel context since new super block
will holds networks namespace reference and it's impossible to recognize, when
and how we have to release this mount point. IOW rpc_get_mount() and
rpc_put_mount() have to be removed.
2) RPC pipefs should provide some new helpers to lookup directory dentry for
those modules which creates pipes, because without RPC pipefs mount point
general lookup can't be performed.
3) These methods must garantee, that pipefs superblock will be active during
pipes creation and destruction.

So, here is the idea of making RPC pipefs works per network namespace context:
1) RPC pipefs superblock should holds network namespcae context while active.
2) RPC pipefs should send notification events on superblock creation and
destruction.
3) RPC pipefs should provide "lookup dentry by name" method for notification
subscribers.
4) RPC pipefs should place superblock reference on current network namespace
context on creation and remove it on destruction.
5) RPC pipefs should provide safe "lookup dentry by name" method for per-net
operations, which garantees, that superblock is active, while
per-net-operations are performing.
6) Client and cache directories creation and destruction should be performed
also on superblock creation and destruction notification events. Note: generic
creation (like now) can fail (if no superblock is not created yet).
7) Pipes creation and destruction should be performed on superblock creation
and destruction events. Also pipes operations should be performed during
per-net operation and in this case they could fail (due to the same reason as
in statement above).

This patch-set implements first 5 points and thus doesn't affects current RPC
pipefs logic.

The only problem about I'm not sure how to solve properly yet, is auth gss
pipes creations operations. Hoping for some help with it.


The following series consists of:

---

Stanislav Kinsbursky (5):
      SUNRPC: hold current network namespace while pipefs superblock is active
      SUNRPC: send notification events on pipefs sb creation and destruction
      SUNRPC: pipefs dentry lookup helper introduced
      SUNRPC: put pipefs superblock link on network namespace
      SUNRPC: pipefs per-net operations helper introduced


 include/linux/sunrpc/rpc_pipe_fs.h |   16 ++++++
 net/sunrpc/netns.h                 |    3 +
 net/sunrpc/rpc_pipe.c              |  103 ++++++++++++++++++++++++++++++++++++
 net/sunrpc/sunrpc_syms.c           |    1 
 4 files changed, 122 insertions(+), 1 deletions(-)

-- 
Signature

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

* [RFC PATCH 1/5] SUNRPC: hold current network namespace while pipefs superblock is active
  2011-10-17 13:10 [RFC PATCH 0/5] SUNRPC: "RPC pipefs per network namespace" preparations Stanislav Kinsbursky
@ 2011-10-17 13:10 ` Stanislav Kinsbursky
  2011-10-17 13:10 ` [RFC PATCH 2/5] SUNRPC: send notification events on pipefs sb creation and destruction Stanislav Kinsbursky
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Stanislav Kinsbursky @ 2011-10-17 13:10 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, bfields, davem,
	devel

We want to be sure that network namespace is still alive while we have pipefs
mounted.

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

---
 net/sunrpc/rpc_pipe.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index b181e34..8322080 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -27,6 +27,9 @@
 #include <linux/workqueue.h>
 #include <linux/sunrpc/rpc_pipe_fs.h>
 #include <linux/sunrpc/cache.h>
+#include <linux/nsproxy.h>
+
+#include "netns.h"
 
 static struct vfsmount *rpc_mnt __read_mostly;
 static int rpc_mount_count;
@@ -1006,6 +1009,7 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
 {
 	struct inode *inode;
 	struct dentry *root;
+	struct net *net = current->nsproxy->net_ns;
 
 	sb->s_blocksize = PAGE_CACHE_SIZE;
 	sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
@@ -1023,6 +1027,7 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
 	}
 	if (rpc_populate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF, NULL))
 		return -ENOMEM;
+	sb->s_fs_info = get_net(net);
 	return 0;
 }
 
@@ -1033,11 +1038,19 @@ rpc_mount(struct file_system_type *fs_type,
 	return mount_single(fs_type, flags, data, rpc_fill_super);
 }
 
+void rpc_kill_sb(struct super_block *sb)
+{
+	struct net *net = sb->s_fs_info;
+
+	put_net(net);
+	kill_litter_super(sb);
+}
+
 static struct file_system_type rpc_pipe_fs_type = {
 	.owner		= THIS_MODULE,
 	.name		= "rpc_pipefs",
 	.mount		= rpc_mount,
-	.kill_sb	= kill_litter_super,
+	.kill_sb	= rpc_kill_sb,
 };
 
 static void

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

* [RFC PATCH 2/5] SUNRPC: send notification events on pipefs sb creation and destruction
  2011-10-17 13:10 [RFC PATCH 0/5] SUNRPC: "RPC pipefs per network namespace" preparations Stanislav Kinsbursky
  2011-10-17 13:10 ` [RFC PATCH 1/5] SUNRPC: hold current network namespace while pipefs superblock is active Stanislav Kinsbursky
@ 2011-10-17 13:10 ` Stanislav Kinsbursky
  2011-10-17 13:10 ` [RFC PATCH 3/5] SUNRPC: pipefs dentry lookup helper introduced Stanislav Kinsbursky
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Stanislav Kinsbursky @ 2011-10-17 13:10 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, bfields, davem,
	devel

It will be used to notify subscribers about pipefs superblock creation and
destruction.
Cubcriders have to create their dentries on passed superblock on mount event
and destroy otherwise.

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

---
 include/linux/sunrpc/rpc_pipe_fs.h |    8 ++++++++
 net/sunrpc/rpc_pipe.c              |   27 +++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index cf14db9..c1cdb2f 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -44,6 +44,14 @@ RPC_I(struct inode *inode)
 	return container_of(inode, struct rpc_inode, vfs_inode);
 }
 
+extern int rpc_pipefs_notifier_register(struct notifier_block *);
+extern void rpc_pipefs_notifier_unregister(struct notifier_block *);
+
+enum {
+	RPC_PIPEFS_MOUNT,
+	RPC_PIPEFS_UMOUNT,
+};
+
 extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
 
 struct rpc_clnt;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 8322080..c90a7e0 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -28,6 +28,7 @@
 #include <linux/sunrpc/rpc_pipe_fs.h>
 #include <linux/sunrpc/cache.h>
 #include <linux/nsproxy.h>
+#include <linux/notifier.h>
 
 #include "netns.h"
 
@@ -41,6 +42,18 @@ static struct kmem_cache *rpc_inode_cachep __read_mostly;
 
 #define RPC_UPCALL_TIMEOUT (30*HZ)
 
+static BLOCKING_NOTIFIER_HEAD(rpc_pipefs_notifier_list);
+
+int rpc_pipefs_notifier_register(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_cond_register(&rpc_pipefs_notifier_list, nb);
+}
+
+void rpc_pipefs_notifier_unregister(struct notifier_block *nb)
+{
+	blocking_notifier_chain_unregister(&rpc_pipefs_notifier_list, nb);
+}
+
 static void rpc_purge_list(struct rpc_inode *rpci, struct list_head *head,
 		void (*destroy_msg)(struct rpc_pipe_msg *), int err)
 {
@@ -1010,6 +1023,7 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
 	struct inode *inode;
 	struct dentry *root;
 	struct net *net = current->nsproxy->net_ns;
+	int err;
 
 	sb->s_blocksize = PAGE_CACHE_SIZE;
 	sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
@@ -1027,8 +1041,18 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
 	}
 	if (rpc_populate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF, NULL))
 		return -ENOMEM;
+	err = blocking_notifier_call_chain(&rpc_pipefs_notifier_list,
+					   RPC_PIPEFS_MOUNT,
+					   sb);
+	if (err)
+		goto err_depopulate;
 	sb->s_fs_info = get_net(net);
 	return 0;
+
+err_depopulate:
+	/* TODO: check if we need to send RPC_PIPEFS_UMOUNT notification. */
+	__rpc_depopulate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF);
+	return err;
 }
 
 static struct dentry *
@@ -1043,6 +1067,9 @@ void rpc_kill_sb(struct super_block *sb)
 	struct net *net = sb->s_fs_info;
 
 	put_net(net);
+	blocking_notifier_call_chain(&rpc_pipefs_notifier_list,
+					   RPC_PIPEFS_UMOUNT,
+					   sb);
 	kill_litter_super(sb);
 }
 

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

* [RFC PATCH 3/5] SUNRPC: pipefs dentry lookup helper introduced
  2011-10-17 13:10 [RFC PATCH 0/5] SUNRPC: "RPC pipefs per network namespace" preparations Stanislav Kinsbursky
  2011-10-17 13:10 ` [RFC PATCH 1/5] SUNRPC: hold current network namespace while pipefs superblock is active Stanislav Kinsbursky
  2011-10-17 13:10 ` [RFC PATCH 2/5] SUNRPC: send notification events on pipefs sb creation and destruction Stanislav Kinsbursky
@ 2011-10-17 13:10 ` Stanislav Kinsbursky
  2011-10-17 13:10 ` [RFC PATCH 4/5] SUNRPC: put pipefs superblock link on network namespace Stanislav Kinsbursky
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Stanislav Kinsbursky @ 2011-10-17 13:10 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, bfields, davem,
	devel

In all places, where pipefs dentries are created, only directory inode is
actually required to create new dentry. And all this directories has root
pipefs dentry as their parent. So we actually don't need this pipefs mount
point at all if some pipefs lookup method will be provided.
IOW, all we really need is just superblock and simple lookup method to find
root's dentry child dentry with appropriate name. And this patch introduces
this method.
Note, that no loking implemented in rpc_d_lookup_sb(). So it can be used only
in case of assurance, that pipefs superblock still exist. IOW, we can use this
method only in pipefs mount-umount notificators.

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

---
 include/linux/sunrpc/rpc_pipe_fs.h |    3 +++
 net/sunrpc/rpc_pipe.c              |   16 ++++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index c1cdb2f..4a327ad 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -52,6 +52,9 @@ enum {
 	RPC_PIPEFS_UMOUNT,
 };
 
+extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
+				      const unsigned char *dir_name);
+
 extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
 
 struct rpc_clnt;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index c90a7e0..a8a8812 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -1017,6 +1017,22 @@ static const struct rpc_filelist files[] = {
 	},
 };
 
+/*
+ * This call can be used only in RPC pipefs mount notification hooks.
+ */
+struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
+			       const unsigned char *dir_name)
+{
+	struct qstr dir = {
+		.name = dir_name,
+		.len = strlen(dir_name),
+		.hash = full_name_hash(dir_name, strlen(dir_name)),
+	};
+
+	return d_lookup(sb->s_root, &dir);
+}
+EXPORT_SYMBOL_GPL(rpc_d_lookup_sb);
+
 static int
 rpc_fill_super(struct super_block *sb, void *data, int silent)
 {

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

* [RFC PATCH 4/5] SUNRPC: put pipefs superblock link on network namespace
  2011-10-17 13:10 [RFC PATCH 0/5] SUNRPC: "RPC pipefs per network namespace" preparations Stanislav Kinsbursky
                   ` (2 preceding siblings ...)
  2011-10-17 13:10 ` [RFC PATCH 3/5] SUNRPC: pipefs dentry lookup helper introduced Stanislav Kinsbursky
@ 2011-10-17 13:10 ` Stanislav Kinsbursky
  2011-10-17 13:10 ` [RFC PATCH 5/5] SUNRPC: pipefs per-net operations helper introduced Stanislav Kinsbursky
  2011-10-20 11:06 ` [RFC PATCH 0/5] SUNRPC: "RPC pipefs per network namespace" preparations Stanislav Kinsbursky
  5 siblings, 0 replies; 9+ messages in thread
From: Stanislav Kinsbursky @ 2011-10-17 13:10 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, bfields, davem,
	devel

We have modules (like, pNFS blocklayout module) which creates pipes on
rpc_pipefs. Thus we need per-net operations for them. To make it possible to
create piepes in per-net operations, we require super block. So we have to put
sb link on network namespace context. Note, that dont't hardly require to
create pipes in per-net operations. IOW, if pipefs wan't mounted yet, that no
sb link reference will peresent on network namespace. In this case we just
passing through pipe
creation. The pipe will be created druing pipefs mount notification.

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

---
 net/sunrpc/netns.h    |    2 ++
 net/sunrpc/rpc_pipe.c |    4 ++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/net/sunrpc/netns.h b/net/sunrpc/netns.h
index d013bf2..b384252 100644
--- a/net/sunrpc/netns.h
+++ b/net/sunrpc/netns.h
@@ -9,6 +9,8 @@ struct cache_detail;
 struct sunrpc_net {
 	struct proc_dir_entry *proc_net_rpc;
 	struct cache_detail *ip_map_cache;
+
+	struct super_block *pipefs_sb;
 };
 
 extern int sunrpc_net_id;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index a8a8812..a873f03 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -1039,6 +1039,7 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
 	struct inode *inode;
 	struct dentry *root;
 	struct net *net = current->nsproxy->net_ns;
+	struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
 	int err;
 
 	sb->s_blocksize = PAGE_CACHE_SIZE;
@@ -1063,6 +1064,7 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
 	if (err)
 		goto err_depopulate;
 	sb->s_fs_info = get_net(net);
+	sn->pipefs_sb = sb;
 	return 0;
 
 err_depopulate:
@@ -1081,7 +1083,9 @@ rpc_mount(struct file_system_type *fs_type,
 void rpc_kill_sb(struct super_block *sb)
 {
 	struct net *net = sb->s_fs_info;
+	struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
 
+	sn->pipefs_sb = NULL;
 	put_net(net);
 	blocking_notifier_call_chain(&rpc_pipefs_notifier_list,
 					   RPC_PIPEFS_UMOUNT,

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

* [RFC PATCH 5/5] SUNRPC: pipefs per-net operations helper introduced
  2011-10-17 13:10 [RFC PATCH 0/5] SUNRPC: "RPC pipefs per network namespace" preparations Stanislav Kinsbursky
                   ` (3 preceding siblings ...)
  2011-10-17 13:10 ` [RFC PATCH 4/5] SUNRPC: put pipefs superblock link on network namespace Stanislav Kinsbursky
@ 2011-10-17 13:10 ` Stanislav Kinsbursky
  2011-10-20 11:06 ` [RFC PATCH 0/5] SUNRPC: "RPC pipefs per network namespace" preparations Stanislav Kinsbursky
  5 siblings, 0 replies; 9+ messages in thread
From: Stanislav Kinsbursky @ 2011-10-17 13:10 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, bfields, davem,
	devel

During per-net operation pipes creation and destruction we have to make sure,
that pipefs sb exists for the whole creation/destruction procedure.
This is done by using special mutex which controls pipefs sb reference on network namespace context.
Helper consist of two parts: first of them (rpc_get_dentry_net) searches for
dentry with specified name and returns with mutex taken on success. When pipe
creation is completed, caller should release this mutex by rpc_put_dentry_net
call.

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

---
 include/linux/sunrpc/rpc_pipe_fs.h |    5 ++++
 net/sunrpc/netns.h                 |    1 +
 net/sunrpc/rpc_pipe.c              |   41 ++++++++++++++++++++++++++++++++++++
 net/sunrpc/sunrpc_syms.c           |    1 +
 4 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index 4a327ad..d48ff0b 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -55,6 +55,11 @@ enum {
 extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
 				      const unsigned char *dir_name);
 
+extern void rpc_pipefs_init_net(struct net *net);
+extern struct dentry *rpc_get_dentry_net(const struct net *net,
+					 const unsigned char *dir_name);
+extern void rpc_put_dentry_net(const struct net *net, struct dentry *dentry);
+
 extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
 
 struct rpc_clnt;
diff --git a/net/sunrpc/netns.h b/net/sunrpc/netns.h
index b384252..11d2f48 100644
--- a/net/sunrpc/netns.h
+++ b/net/sunrpc/netns.h
@@ -11,6 +11,7 @@ struct sunrpc_net {
 	struct cache_detail *ip_map_cache;
 
 	struct super_block *pipefs_sb;
+	struct mutex pipefs_sb_lock;
 };
 
 extern int sunrpc_net_id;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index a873f03..331be28 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -1033,6 +1033,45 @@ struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
 }
 EXPORT_SYMBOL_GPL(rpc_d_lookup_sb);
 
+void rpc_pipefs_init_net(struct net *net)
+{
+	struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
+
+	mutex_init(&sn->pipefs_sb_lock);
+}
+
+/*
+ * This call will be used for per network namespace operations calls.
+ * Note: Function will be returned with pipefs_sb_lock taken if dentry was
+ * found. This lock have to be released by rpc_put_dentry_net() when all
+ * operations will be completed.
+ */
+struct dentry *rpc_get_dentry_net(const struct net *net,
+				  const unsigned char *dir_name)
+{
+	struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
+	struct dentry *dentry = ERR_PTR(-ENOENT);
+
+	mutex_lock(&sn->pipefs_sb_lock);
+	if (sn->pipefs_sb) {
+		dentry = rpc_d_lookup_sb(sn->pipefs_sb, dir_name);
+		if (dentry)
+			return dentry;
+	}
+	mutex_unlock(&sn->pipefs_sb_lock);
+	return ERR_PTR(-ENOENT);
+}
+EXPORT_SYMBOL_GPL(rpc_get_dentry_net);
+
+void rpc_put_dentry_net(const struct net *net, struct dentry *dentry)
+{
+	struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
+
+	dput(dentry);
+	mutex_unlock(&sn->pipefs_sb_lock);
+}
+EXPORT_SYMBOL_GPL(rpc_put_dentry_net);
+
 static int
 rpc_fill_super(struct super_block *sb, void *data, int silent)
 {
@@ -1085,7 +1124,9 @@ void rpc_kill_sb(struct super_block *sb)
 	struct net *net = sb->s_fs_info;
 	struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
 
+	mutex_lock(&sn->pipefs_sb_lock);
 	sn->pipefs_sb = NULL;
+	mutex_unlock(&sn->pipefs_sb_lock);
 	put_net(net);
 	blocking_notifier_call_chain(&rpc_pipefs_notifier_list,
 					   RPC_PIPEFS_UMOUNT,
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index 9d08091..880de8b 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -38,6 +38,7 @@ static __net_init int sunrpc_init_net(struct net *net)
 	if (err)
 		goto err_ipmap;
 
+	rpc_pipefs_init_net(net);
 	return 0;
 
 err_ipmap:

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

* Re: [RFC PATCH 0/5] SUNRPC: "RPC pipefs per network namespace" preparations
  2011-10-17 13:10 [RFC PATCH 0/5] SUNRPC: "RPC pipefs per network namespace" preparations Stanislav Kinsbursky
                   ` (4 preceding siblings ...)
  2011-10-17 13:10 ` [RFC PATCH 5/5] SUNRPC: pipefs per-net operations helper introduced Stanislav Kinsbursky
@ 2011-10-20 11:06 ` Stanislav Kinsbursky
       [not found]   ` <4EA000C6.1040502-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
  5 siblings, 1 reply; 9+ messages in thread
From: Stanislav Kinsbursky @ 2011-10-20 11:06 UTC (permalink / raw)
  To: Trond.Myklebust@netapp.com
  Cc: linux-nfs@vger.kernel.org, Pavel Emelianov, neilb@suse.de,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	bfields@fieldses.org, davem@davemloft.net, devel@openvz.org

Guys, please, spend some of your expensive time to review this patch-set briefly.
This is not for commit, but just an idea representation.
I really need some opinions about it, since all my further work aroud RPC pipefs 
depends on it.
IOW I need to now, does anyone has something against this idea.
Trond, please, respond, does this idea suits you in general or not?

17.10.2011 17:10, Stanislav Kinsbursky пишет:
> Hello to everyone.
> RPC pipefs file system have to work per network namespace context is required
> prior to any NFS modifications.
> This is a way how to do it. I'll really appreciate for any comments.
>
> There are several statements about how to make RPC pipefs working per network
> namespace context.
> Here they are:
> 1) RPC pipefs should be mounted per network namespace context.
> 2) RPC pipefs superblock should holds network namespace while active.
> 3) RPC pipefs lookup and readir should be perfomed in network namespace context
> it was mounted. IOW, user-space process, working in another network namespace
> context, should see RPC pipefs dentries from network namespace context this
> mount-point was created (like it was done for sysfs).
>
> These statement leads to some restrictions which we must follow during
> implementation. Here are they:
> 1) RPC pipefs mount can't be performed in kernel context since new super block
> will holds networks namespace reference and it's impossible to recognize, when
> and how we have to release this mount point. IOW rpc_get_mount() and
> rpc_put_mount() have to be removed.
> 2) RPC pipefs should provide some new helpers to lookup directory dentry for
> those modules which creates pipes, because without RPC pipefs mount point
> general lookup can't be performed.
> 3) These methods must garantee, that pipefs superblock will be active during
> pipes creation and destruction.
>
> So, here is the idea of making RPC pipefs works per network namespace context:
> 1) RPC pipefs superblock should holds network namespcae context while active.
> 2) RPC pipefs should send notification events on superblock creation and
> destruction.
> 3) RPC pipefs should provide "lookup dentry by name" method for notification
> subscribers.
> 4) RPC pipefs should place superblock reference on current network namespace
> context on creation and remove it on destruction.
> 5) RPC pipefs should provide safe "lookup dentry by name" method for per-net
> operations, which garantees, that superblock is active, while
> per-net-operations are performing.
> 6) Client and cache directories creation and destruction should be performed
> also on superblock creation and destruction notification events. Note: generic
> creation (like now) can fail (if no superblock is not created yet).
> 7) Pipes creation and destruction should be performed on superblock creation
> and destruction events. Also pipes operations should be performed during
> per-net operation and in this case they could fail (due to the same reason as
> in statement above).
>
> This patch-set implements first 5 points and thus doesn't affects current RPC
> pipefs logic.
>
> The only problem about I'm not sure how to solve properly yet, is auth gss
> pipes creations operations. Hoping for some help with it.
>
>
> The following series consists of:
>
> ---
>
> Stanislav Kinsbursky (5):
>        SUNRPC: hold current network namespace while pipefs superblock is active
>        SUNRPC: send notification events on pipefs sb creation and destruction
>        SUNRPC: pipefs dentry lookup helper introduced
>        SUNRPC: put pipefs superblock link on network namespace
>        SUNRPC: pipefs per-net operations helper introduced
>
>
>   include/linux/sunrpc/rpc_pipe_fs.h |   16 ++++++
>   net/sunrpc/netns.h                 |    3 +
>   net/sunrpc/rpc_pipe.c              |  103 ++++++++++++++++++++++++++++++++++++
>   net/sunrpc/sunrpc_syms.c           |    1
>   4 files changed, 122 insertions(+), 1 deletions(-)
>


-- 
Best regards,
Stanislav Kinsbursky

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

* Re: [RFC PATCH 0/5] SUNRPC: "RPC pipefs per network namespace" preparations
       [not found]   ` <4EA000C6.1040502-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
@ 2011-10-20 12:32     ` bfields-uC3wQj2KruNg9hUCZPvPmw
  2011-10-20 12:56       ` Stanislav Kinsbursky
  0 siblings, 1 reply; 9+ messages in thread
From: bfields-uC3wQj2KruNg9hUCZPvPmw @ 2011-10-20 12:32 UTC (permalink / raw)
  To: Stanislav Kinsbursky
  Cc: Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Pavel Emelianov, neilb-l3A5Bk7waGM@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
	devel-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org

On Thu, Oct 20, 2011 at 03:06:46PM +0400, Stanislav Kinsbursky wrote:
> Guys, please, spend some of your expensive time to review this patch-set briefly.

I'll try to take a look soon, but I'm travelling tomorrow through the
31st, and things will be a little hectic.

Just one quick comment:

> >The only problem about I'm not sure how to solve properly yet, is auth gss
> >pipes creations operations. Hoping for some help with it.

I suspect one reason it may be a little complicated is the
upcall-version switching.  The old version is deprecated, and there's no
need to support the combination of the old version with the a new
feature like containers.  And now that it's been there a while the
version-switching code already achieved its goal of avoiding a flag day.
So, one approach might be:

	- move all the code for the old gss upcall and for the version
	  switching under a new CONFIG_DEPRECATED_GSS, or similar.
	- print a warning if the old stuff is used, and plan to rip it
	  out completely in a future kernel version.
	- do something that works just in the !CONFIG_DEPRECATED_GSS
	  case.

Would that help?

--b.
--
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] 9+ messages in thread

* Re: [RFC PATCH 0/5] SUNRPC: "RPC pipefs per network namespace" preparations
  2011-10-20 12:32     ` bfields-uC3wQj2KruNg9hUCZPvPmw
@ 2011-10-20 12:56       ` Stanislav Kinsbursky
  0 siblings, 0 replies; 9+ messages in thread
From: Stanislav Kinsbursky @ 2011-10-20 12:56 UTC (permalink / raw)
  To: bfields@fieldses.org
  Cc: Trond.Myklebust@netapp.com, linux-nfs@vger.kernel.org,
	Pavel Emelianov, neilb@suse.de, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, davem@davemloft.net,
	devel@openvz.org

20.10.2011 16:32, bfields@fieldses.org пишет:
> On Thu, Oct 20, 2011 at 03:06:46PM +0400, Stanislav Kinsbursky wrote:
>> Guys, please, spend some of your expensive time to review this patch-set briefly.
>
> I'll try to take a look soon, but I'm travelling tomorrow through the
> 31st, and things will be a little hectic.
>

Thanks for your time, Bruce.

> Just one quick comment:
>
>>> The only problem about I'm not sure how to solve properly yet, is auth gss
>>> pipes creations operations. Hoping for some help with it.
>
> I suspect one reason it may be a little complicated is the
> upcall-version switching.  The old version is deprecated, and there's no
> need to support the combination of the old version with the a new
> feature like containers.  And now that it's been there a while the
> version-switching code already achieved its goal of avoiding a flag day.
> So, one approach might be:
>
> 	- move all the code for the old gss upcall and for the version
> 	  switching under a new CONFIG_DEPRECATED_GSS, or similar.
> 	- print a warning if the old stuff is used, and plan to rip it
> 	  out completely in a future kernel version.
> 	- do something that works just in the !CONFIG_DEPRECATED_GSS
> 	  case.
>

Thanks for this comment. I'll check the code for problem you mentioned here.
But I was actually talking about other thing.
Currently we create pipe in gss without any checks since we assume, that pipefs 
client dir is created already.
But with approach, represented in this patch set, pipes and dirs will be created 
only when pipefs was mounted from user-space. I.e. clients with gss auth may 
already present and some callback is required for creating gss pipes.
And also this approch assumes existence of gss auth without pipe.

> Would that help?
>
> --b.


-- 
Best regards,
Stanislav Kinsbursky

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

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

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-17 13:10 [RFC PATCH 0/5] SUNRPC: "RPC pipefs per network namespace" preparations Stanislav Kinsbursky
2011-10-17 13:10 ` [RFC PATCH 1/5] SUNRPC: hold current network namespace while pipefs superblock is active Stanislav Kinsbursky
2011-10-17 13:10 ` [RFC PATCH 2/5] SUNRPC: send notification events on pipefs sb creation and destruction Stanislav Kinsbursky
2011-10-17 13:10 ` [RFC PATCH 3/5] SUNRPC: pipefs dentry lookup helper introduced Stanislav Kinsbursky
2011-10-17 13:10 ` [RFC PATCH 4/5] SUNRPC: put pipefs superblock link on network namespace Stanislav Kinsbursky
2011-10-17 13:10 ` [RFC PATCH 5/5] SUNRPC: pipefs per-net operations helper introduced Stanislav Kinsbursky
2011-10-20 11:06 ` [RFC PATCH 0/5] SUNRPC: "RPC pipefs per network namespace" preparations Stanislav Kinsbursky
     [not found]   ` <4EA000C6.1040502-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2011-10-20 12:32     ` bfields-uC3wQj2KruNg9hUCZPvPmw
2011-10-20 12:56       ` Stanislav Kinsbursky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).