aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/export.c28
-rw-r--r--fs/nfsd/netns.h1
-rw-r--r--fs/nfsd/nfsctl.c3
-rw-r--r--include/linux/nfsd/export.h2
-rw-r--r--include/linux/sunrpc/svcauth.h2
-rw-r--r--net/sunrpc/svcauth_unix.c13
6 files changed, 25 insertions, 24 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 84d020fc0e37..dcb52b884519 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -40,7 +40,6 @@ typedef struct svc_export svc_export;
40#define EXPKEY_HASHBITS 8 40#define EXPKEY_HASHBITS 8
41#define EXPKEY_HASHMAX (1 << EXPKEY_HASHBITS) 41#define EXPKEY_HASHMAX (1 << EXPKEY_HASHBITS)
42#define EXPKEY_HASHMASK (EXPKEY_HASHMAX -1) 42#define EXPKEY_HASHMASK (EXPKEY_HASHMAX -1)
43static struct cache_head *expkey_table[EXPKEY_HASHMAX];
44 43
45static void expkey_put(struct kref *ref) 44static void expkey_put(struct kref *ref)
46{ 45{
@@ -241,10 +240,9 @@ static struct cache_head *expkey_alloc(void)
241 return NULL; 240 return NULL;
242} 241}
243 242
244static struct cache_detail svc_expkey_cache = { 243static struct cache_detail svc_expkey_cache_template = {
245 .owner = THIS_MODULE, 244 .owner = THIS_MODULE,
246 .hash_size = EXPKEY_HASHMAX, 245 .hash_size = EXPKEY_HASHMAX,
247 .hash_table = expkey_table,
248 .name = "nfsd.fh", 246 .name = "nfsd.fh",
249 .cache_put = expkey_put, 247 .cache_put = expkey_put,
250 .cache_upcall = expkey_upcall, 248 .cache_upcall = expkey_upcall,
@@ -883,12 +881,13 @@ static struct svc_export *exp_find(struct cache_detail *cd,
883 u32 *fsidv, struct cache_req *reqp) 881 u32 *fsidv, struct cache_req *reqp)
884{ 882{
885 struct svc_export *exp; 883 struct svc_export *exp;
886 struct svc_expkey *ek = exp_find_key(&svc_expkey_cache, clp, fsid_type, fsidv, reqp); 884 struct nfsd_net *nn = net_generic(cd->net, nfsd_net_id);
885 struct svc_expkey *ek = exp_find_key(nn->svc_expkey_cache, clp, fsid_type, fsidv, reqp);
887 if (IS_ERR(ek)) 886 if (IS_ERR(ek))
888 return ERR_CAST(ek); 887 return ERR_CAST(ek);
889 888
890 exp = exp_get_by_name(cd, clp, &ek->ek_path, reqp); 889 exp = exp_get_by_name(cd, clp, &ek->ek_path, reqp);
891 cache_put(&ek->h, &svc_expkey_cache); 890 cache_put(&ek->h, nn->svc_expkey_cache);
892 891
893 if (IS_ERR(exp)) 892 if (IS_ERR(exp))
894 return ERR_CAST(exp); 893 return ERR_CAST(exp);
@@ -1232,7 +1231,6 @@ const struct seq_operations nfs_exports_op = {
1232 .show = e_show, 1231 .show = e_show,
1233}; 1232};
1234 1233
1235
1236/* 1234/*
1237 * Initialize the exports module. 1235 * Initialize the exports module.
1238 */ 1236 */
@@ -1251,11 +1249,18 @@ nfsd_export_init(struct net *net)
1251 if (rv) 1249 if (rv)
1252 goto destroy_export_cache; 1250 goto destroy_export_cache;
1253 1251
1254 rv = cache_register_net(&svc_expkey_cache, net); 1252 nn->svc_expkey_cache = cache_create_net(&svc_expkey_cache_template, net);
1255 if (rv) 1253 if (IS_ERR(nn->svc_expkey_cache)) {
1254 rv = PTR_ERR(nn->svc_expkey_cache);
1256 goto unregister_export_cache; 1255 goto unregister_export_cache;
1256 }
1257 rv = cache_register_net(nn->svc_expkey_cache, net);
1258 if (rv)
1259 goto destroy_expkey_cache;
1257 return 0; 1260 return 0;
1258 1261
1262destroy_expkey_cache:
1263 cache_destroy_net(nn->svc_expkey_cache, net);
1259unregister_export_cache: 1264unregister_export_cache:
1260 cache_unregister_net(nn->svc_export_cache, net); 1265 cache_unregister_net(nn->svc_export_cache, net);
1261destroy_export_cache: 1266destroy_export_cache:
@@ -1271,7 +1276,7 @@ nfsd_export_flush(struct net *net)
1271{ 1276{
1272 struct nfsd_net *nn = net_generic(net, nfsd_net_id); 1277 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
1273 1278
1274 cache_purge(&svc_expkey_cache); 1279 cache_purge(nn->svc_expkey_cache);
1275 cache_purge(nn->svc_export_cache); 1280 cache_purge(nn->svc_export_cache);
1276} 1281}
1277 1282
@@ -1285,10 +1290,11 @@ nfsd_export_shutdown(struct net *net)
1285 1290
1286 dprintk("nfsd: shutting down export module (net: %p).\n", net); 1291 dprintk("nfsd: shutting down export module (net: %p).\n", net);
1287 1292
1288 cache_unregister_net(&svc_expkey_cache, net); 1293 cache_unregister_net(nn->svc_expkey_cache, net);
1289 cache_unregister_net(nn->svc_export_cache, net); 1294 cache_unregister_net(nn->svc_export_cache, net);
1295 cache_destroy_net(nn->svc_expkey_cache, net);
1290 cache_destroy_net(nn->svc_export_cache, net); 1296 cache_destroy_net(nn->svc_export_cache, net);
1291 svcauth_unix_purge(); 1297 svcauth_unix_purge(net);
1292 1298
1293 dprintk("nfsd: export shutdown complete (net: %p).\n", net); 1299 dprintk("nfsd: export shutdown complete (net: %p).\n", net);
1294} 1300}
diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
index c1c6242942a9..9794c6c7d133 100644
--- a/fs/nfsd/netns.h
+++ b/fs/nfsd/netns.h
@@ -29,6 +29,7 @@ struct cld_net;
29struct nfsd_net { 29struct nfsd_net {
30 struct cld_net *cld_net; 30 struct cld_net *cld_net;
31 31
32 struct cache_detail *svc_expkey_cache;
32 struct cache_detail *svc_export_cache; 33 struct cache_detail *svc_export_cache;
33}; 34};
34 35
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index ddb9f8787379..b14417740816 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -129,13 +129,14 @@ static int exports_open(struct inode *inode, struct file *file)
129{ 129{
130 int err; 130 int err;
131 struct seq_file *seq; 131 struct seq_file *seq;
132 struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id);
132 133
133 err = seq_open(file, &nfs_exports_op); 134 err = seq_open(file, &nfs_exports_op);
134 if (err) 135 if (err)
135 return err; 136 return err;
136 137
137 seq = file->private_data; 138 seq = file->private_data;
138 seq->private = &svc_export_cache; 139 seq->private = nn->svc_export_cache;
139 return 0; 140 return 0;
140} 141}
141 142
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 565c2122993f..e33f747b173c 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -143,8 +143,6 @@ int exp_rootfh(struct net *, struct auth_domain *,
143__be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *); 143__be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *);
144__be32 nfserrno(int errno); 144__be32 nfserrno(int errno);
145 145
146extern struct cache_detail svc_export_cache;
147
148static inline void exp_put(struct svc_export *exp) 146static inline void exp_put(struct svc_export *exp)
149{ 147{
150 cache_put(&exp->h, exp->cd); 148 cache_put(&exp->h, exp->cd);
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index 2e2af101b59c..2c54683b91de 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -130,7 +130,7 @@ extern struct auth_domain *auth_domain_lookup(char *name, struct auth_domain *ne
130extern struct auth_domain *auth_domain_find(char *name); 130extern struct auth_domain *auth_domain_find(char *name);
131extern struct auth_domain *auth_unix_lookup(struct net *net, struct in6_addr *addr); 131extern struct auth_domain *auth_unix_lookup(struct net *net, struct in6_addr *addr);
132extern int auth_unix_forget_old(struct auth_domain *dom); 132extern int auth_unix_forget_old(struct auth_domain *dom);
133extern void svcauth_unix_purge(void); 133extern void svcauth_unix_purge(struct net *net);
134extern void svcauth_unix_info_release(struct svc_xprt *xpt); 134extern void svcauth_unix_info_release(struct svc_xprt *xpt);
135extern int svcauth_unix_set_client(struct svc_rqst *rqstp); 135extern int svcauth_unix_set_client(struct svc_rqst *rqstp);
136 136
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 521d8f7dc833..9c3b9f014468 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -346,17 +346,12 @@ static inline int ip_map_update(struct net *net, struct ip_map *ipm,
346 return __ip_map_update(sn->ip_map_cache, ipm, udom, expiry); 346 return __ip_map_update(sn->ip_map_cache, ipm, udom, expiry);
347} 347}
348 348
349 349void svcauth_unix_purge(struct net *net)
350void svcauth_unix_purge(void)
351{ 350{
352 struct net *net; 351 struct sunrpc_net *sn;
353
354 for_each_net(net) {
355 struct sunrpc_net *sn;
356 352
357 sn = net_generic(net, sunrpc_net_id); 353 sn = net_generic(net, sunrpc_net_id);
358 cache_purge(sn->ip_map_cache); 354 cache_purge(sn->ip_map_cache);
359 }
360} 355}
361EXPORT_SYMBOL_GPL(svcauth_unix_purge); 356EXPORT_SYMBOL_GPL(svcauth_unix_purge);
362 357