aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2011-12-26 07:39:13 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-01-31 18:20:24 -0500
commit2d00131acc641b2cb6f0bdefb8c7bdd8fdf7410b (patch)
treee8351c57f8d12431e7e02f7ff44960dde11800b7 /net
parent021c68dec8c04c44cb82eb5bbee77028fafe22e8 (diff)
SUNRPC: send notification events on pipefs sb creation and destruction
They will be used to notify subscribers about pipefs superblock creation and destruction. Subcribers will have to create their dentries on passed superblock on mount event and destroy otherwise. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/rpc_pipe.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index f628b0f48a87..58a5062df260 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -28,8 +28,10 @@
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> 30#include <linux/nsproxy.h>
31#include <linux/notifier.h>
31 32
32#include "netns.h" 33#include "netns.h"
34#include "sunrpc.h"
33 35
34static struct vfsmount *rpc_mnt __read_mostly; 36static struct vfsmount *rpc_mnt __read_mostly;
35static int rpc_mount_count; 37static int rpc_mount_count;
@@ -41,6 +43,20 @@ static struct kmem_cache *rpc_inode_cachep __read_mostly;
41 43
42#define RPC_UPCALL_TIMEOUT (30*HZ) 44#define RPC_UPCALL_TIMEOUT (30*HZ)
43 45
46static BLOCKING_NOTIFIER_HEAD(rpc_pipefs_notifier_list);
47
48int rpc_pipefs_notifier_register(struct notifier_block *nb)
49{
50 return blocking_notifier_chain_cond_register(&rpc_pipefs_notifier_list, nb);
51}
52EXPORT_SYMBOL_GPL(rpc_pipefs_notifier_register);
53
54void rpc_pipefs_notifier_unregister(struct notifier_block *nb)
55{
56 blocking_notifier_chain_unregister(&rpc_pipefs_notifier_list, nb);
57}
58EXPORT_SYMBOL_GPL(rpc_pipefs_notifier_unregister);
59
44static void rpc_purge_list(struct rpc_inode *rpci, struct list_head *head, 60static void rpc_purge_list(struct rpc_inode *rpci, struct list_head *head,
45 void (*destroy_msg)(struct rpc_pipe_msg *), int err) 61 void (*destroy_msg)(struct rpc_pipe_msg *), int err)
46{ 62{
@@ -997,6 +1013,7 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
997 struct inode *inode; 1013 struct inode *inode;
998 struct dentry *root; 1014 struct dentry *root;
999 struct net *net = data; 1015 struct net *net = data;
1016 int err;
1000 1017
1001 sb->s_blocksize = PAGE_CACHE_SIZE; 1018 sb->s_blocksize = PAGE_CACHE_SIZE;
1002 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 1019 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
@@ -1014,8 +1031,20 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
1014 } 1031 }
1015 if (rpc_populate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF, NULL)) 1032 if (rpc_populate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF, NULL))
1016 return -ENOMEM; 1033 return -ENOMEM;
1034 err = blocking_notifier_call_chain(&rpc_pipefs_notifier_list,
1035 RPC_PIPEFS_MOUNT,
1036 sb);
1037 if (err)
1038 goto err_depopulate;
1017 sb->s_fs_info = get_net(net); 1039 sb->s_fs_info = get_net(net);
1018 return 0; 1040 return 0;
1041
1042err_depopulate:
1043 blocking_notifier_call_chain(&rpc_pipefs_notifier_list,
1044 RPC_PIPEFS_UMOUNT,
1045 sb);
1046 __rpc_depopulate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF);
1047 return err;
1019} 1048}
1020 1049
1021static struct dentry * 1050static struct dentry *
@@ -1030,6 +1059,9 @@ void rpc_kill_sb(struct super_block *sb)
1030 struct net *net = sb->s_fs_info; 1059 struct net *net = sb->s_fs_info;
1031 1060
1032 put_net(net); 1061 put_net(net);
1062 blocking_notifier_call_chain(&rpc_pipefs_notifier_list,
1063 RPC_PIPEFS_UMOUNT,
1064 sb);
1033 kill_litter_super(sb); 1065 kill_litter_super(sb);
1034} 1066}
1035 1067