SUNRPC: Add a framework to clean up management of rpc_pipefs directories

The current system requires everyone to set up notifiers, manage directory
locking, etc.
What we really want to do is have the rpc_client create its directory,
and then create all the entries.

This patch will allow the RPCSEC_GSS and NFS code to register all the
objects that they want to have appear in the directory, and then have
the sunrpc code call them back to actually create/destroy their pipefs
dentries when the rpc_client creates/destroys the parent.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Trond Myklebust
2013-08-26 15:38:11 -04:00
parent d7631250b2
commit 6739ffb754
4 changed files with 168 additions and 4 deletions

View File

@@ -21,6 +21,7 @@
#include <linux/sunrpc/stats.h>
#include <linux/sunrpc/xdr.h>
#include <linux/sunrpc/timer.h>
#include <linux/sunrpc/rpc_pipe_fs.h>
#include <asm/signal.h>
#include <linux/path.h>
#include <net/ipv6.h>
@@ -55,6 +56,7 @@ struct rpc_clnt {
int cl_nodelen; /* nodename length */
char cl_nodename[UNX_MAXNODENAME];
struct rpc_pipe_dir_head cl_pipedir_objects;
struct dentry * cl_dentry;
struct rpc_clnt * cl_parent; /* Points to parent of clones */
struct rpc_rtt cl_rtt_default;

View File

@@ -5,6 +5,26 @@
#include <linux/workqueue.h>
struct rpc_pipe_dir_head {
struct list_head pdh_entries;
struct dentry *pdh_dentry;
};
struct rpc_pipe_dir_object_ops;
struct rpc_pipe_dir_object {
struct list_head pdo_head;
const struct rpc_pipe_dir_object_ops *pdo_ops;
void *pdo_data;
};
struct rpc_pipe_dir_object_ops {
int (*create)(struct dentry *dir,
struct rpc_pipe_dir_object *pdo);
void (*destroy)(struct dentry *dir,
struct rpc_pipe_dir_object *pdo);
};
struct rpc_pipe_msg {
struct list_head list;
void *data;
@@ -74,7 +94,18 @@ extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *);
struct rpc_clnt;
extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *);
extern int rpc_remove_client_dir(struct dentry *);
extern int rpc_remove_client_dir(struct dentry *, struct rpc_clnt *);
extern void rpc_init_pipe_dir_head(struct rpc_pipe_dir_head *pdh);
extern void rpc_init_pipe_dir_object(struct rpc_pipe_dir_object *pdo,
const struct rpc_pipe_dir_object_ops *pdo_ops,
void *pdo_data);
extern int rpc_add_pipe_dir_object(struct net *net,
struct rpc_pipe_dir_head *pdh,
struct rpc_pipe_dir_object *pdo);
extern void rpc_remove_pipe_dir_object(struct net *net,
struct rpc_pipe_dir_head *pdh,
struct rpc_pipe_dir_object *pdo);
struct cache_detail;
extern struct dentry *rpc_create_cache_dir(struct dentry *,