|
@@ -34,6 +34,7 @@
|
|
#include <linux/sunrpc/cache.h>
|
|
#include <linux/sunrpc/cache.h>
|
|
#include <linux/sunrpc/stats.h>
|
|
#include <linux/sunrpc/stats.h>
|
|
#include <linux/sunrpc/rpc_pipe_fs.h>
|
|
#include <linux/sunrpc/rpc_pipe_fs.h>
|
|
|
|
+#include <net/net_namespace.h>
|
|
|
|
|
|
#define RPCDBG_FACILITY RPCDBG_CACHE
|
|
#define RPCDBG_FACILITY RPCDBG_CACHE
|
|
|
|
|
|
@@ -1537,7 +1538,7 @@ static const struct file_operations cache_flush_operations_procfs = {
|
|
.release = release_flush_procfs,
|
|
.release = release_flush_procfs,
|
|
};
|
|
};
|
|
|
|
|
|
-static void remove_cache_proc_entries(struct cache_detail *cd)
|
|
|
|
|
|
+static void remove_cache_proc_entries(struct cache_detail *cd, struct net *net)
|
|
{
|
|
{
|
|
if (cd->u.procfs.proc_ent == NULL)
|
|
if (cd->u.procfs.proc_ent == NULL)
|
|
return;
|
|
return;
|
|
@@ -1552,7 +1553,7 @@ static void remove_cache_proc_entries(struct cache_detail *cd)
|
|
}
|
|
}
|
|
|
|
|
|
#ifdef CONFIG_PROC_FS
|
|
#ifdef CONFIG_PROC_FS
|
|
-static int create_cache_proc_entries(struct cache_detail *cd)
|
|
|
|
|
|
+static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)
|
|
{
|
|
{
|
|
struct proc_dir_entry *p;
|
|
struct proc_dir_entry *p;
|
|
|
|
|
|
@@ -1587,11 +1588,11 @@ static int create_cache_proc_entries(struct cache_detail *cd)
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
out_nomem:
|
|
out_nomem:
|
|
- remove_cache_proc_entries(cd);
|
|
|
|
|
|
+ remove_cache_proc_entries(cd, net);
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
}
|
|
}
|
|
#else /* CONFIG_PROC_FS */
|
|
#else /* CONFIG_PROC_FS */
|
|
-static int create_cache_proc_entries(struct cache_detail *cd)
|
|
|
|
|
|
+static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)
|
|
{
|
|
{
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -1602,23 +1603,33 @@ void __init cache_initialize(void)
|
|
INIT_DELAYED_WORK_DEFERRABLE(&cache_cleaner, do_cache_clean);
|
|
INIT_DELAYED_WORK_DEFERRABLE(&cache_cleaner, do_cache_clean);
|
|
}
|
|
}
|
|
|
|
|
|
-int cache_register(struct cache_detail *cd)
|
|
|
|
|
|
+int cache_register_net(struct cache_detail *cd, struct net *net)
|
|
{
|
|
{
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
sunrpc_init_cache_detail(cd);
|
|
sunrpc_init_cache_detail(cd);
|
|
- ret = create_cache_proc_entries(cd);
|
|
|
|
|
|
+ ret = create_cache_proc_entries(cd, net);
|
|
if (ret)
|
|
if (ret)
|
|
sunrpc_destroy_cache_detail(cd);
|
|
sunrpc_destroy_cache_detail(cd);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+int cache_register(struct cache_detail *cd)
|
|
|
|
+{
|
|
|
|
+ return cache_register_net(cd, &init_net);
|
|
|
|
+}
|
|
EXPORT_SYMBOL_GPL(cache_register);
|
|
EXPORT_SYMBOL_GPL(cache_register);
|
|
|
|
|
|
-void cache_unregister(struct cache_detail *cd)
|
|
|
|
|
|
+void cache_unregister_net(struct cache_detail *cd, struct net *net)
|
|
{
|
|
{
|
|
- remove_cache_proc_entries(cd);
|
|
|
|
|
|
+ remove_cache_proc_entries(cd, net);
|
|
sunrpc_destroy_cache_detail(cd);
|
|
sunrpc_destroy_cache_detail(cd);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+void cache_unregister(struct cache_detail *cd)
|
|
|
|
+{
|
|
|
|
+ cache_unregister_net(cd, &init_net);
|
|
|
|
+}
|
|
EXPORT_SYMBOL_GPL(cache_unregister);
|
|
EXPORT_SYMBOL_GPL(cache_unregister);
|
|
|
|
|
|
static ssize_t cache_read_pipefs(struct file *filp, char __user *buf,
|
|
static ssize_t cache_read_pipefs(struct file *filp, char __user *buf,
|