aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/dns_resolve.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-28 21:02:55 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-28 21:02:55 -0500
commitb6669737d3db7df79fad07180837c23dbe581db5 (patch)
tree671a9d13fe5ab00d6a3c7c5c5c466802ca96d38a /fs/nfs/dns_resolve.c
parent1cf0209c431fa7790253c532039d53b0773193aa (diff)
parentdc107402ae06286a9ed33c32daf3f35514a7cb8d (diff)
Merge branch 'for-3.9' of git://linux-nfs.org/~bfields/linux
Pull nfsd changes from J Bruce Fields: "Miscellaneous bugfixes, plus: - An overhaul of the DRC cache by Jeff Layton. The main effect is just to make it larger. This decreases the chances of intermittent errors especially in the UDP case. But we'll need to watch for any reports of performance regressions. - Containerized nfsd: with some limitations, we now support per-container nfs-service, thanks to extensive work from Stanislav Kinsbursky over the last year." Some notes about conflicts, since there were *two* non-data semantic conflicts here: - idr_remove_all() had been added by a memory leak fix, but has since become deprecated since idr_destroy() does it for us now. - xs_local_connect() had been added by this branch to make AF_LOCAL connections be synchronous, but in the meantime Trond had changed the calling convention in order to avoid a RCU dereference. There were a couple of more obvious actual source-level conflicts due to the hlist traversal changes and one just due to code changes next to each other, but those were trivial. * 'for-3.9' of git://linux-nfs.org/~bfields/linux: (49 commits) SUNRPC: make AF_LOCAL connect synchronous nfsd: fix compiler warning about ambiguous types in nfsd_cache_csum svcrpc: fix rpc server shutdown races svcrpc: make svc_age_temp_xprts enqueue under sv_lock lockd: nlmclnt_reclaim(): avoid stack overflow nfsd: enable NFSv4 state in containers nfsd: disable usermode helper client tracker in container nfsd: use proper net while reading "exports" file nfsd: containerize NFSd filesystem nfsd: fix comments on nfsd_cache_lookup SUNRPC: move cache_detail->cache_request callback call to cache_read() SUNRPC: remove "cache_request" argument in sunrpc_cache_pipe_upcall() function SUNRPC: rework cache upcall logic SUNRPC: introduce cache_detail->cache_request callback NFS: simplify and clean cache library NFS: use SUNRPC cache creation and destruction helper for DNS cache nfsd4: free_stid can be static nfsd: keep a checksum of the first 256 bytes of request sunrpc: trim off trailing checksum before returning decrypted or integrity authenticated buffer sunrpc: fix comment in struct xdr_buf definition ...
Diffstat (limited to 'fs/nfs/dns_resolve.c')
-rw-r--r--fs/nfs/dns_resolve.c67
1 files changed, 28 insertions, 39 deletions
diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c
index ca4b11ec87a2..945527092295 100644
--- a/fs/nfs/dns_resolve.c
+++ b/fs/nfs/dns_resolve.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/sunrpc/clnt.h> 12#include <linux/sunrpc/clnt.h>
13#include <linux/sunrpc/addr.h>
13#include <linux/dns_resolver.h> 14#include <linux/dns_resolver.h>
14#include "dns_resolve.h" 15#include "dns_resolve.h"
15 16
@@ -42,6 +43,7 @@ EXPORT_SYMBOL_GPL(nfs_dns_resolve_name);
42#include <linux/seq_file.h> 43#include <linux/seq_file.h>
43#include <linux/inet.h> 44#include <linux/inet.h>
44#include <linux/sunrpc/clnt.h> 45#include <linux/sunrpc/clnt.h>
46#include <linux/sunrpc/addr.h>
45#include <linux/sunrpc/cache.h> 47#include <linux/sunrpc/cache.h>
46#include <linux/sunrpc/svcauth.h> 48#include <linux/sunrpc/svcauth.h>
47#include <linux/sunrpc/rpc_pipe_fs.h> 49#include <linux/sunrpc/rpc_pipe_fs.h>
@@ -142,7 +144,7 @@ static int nfs_dns_upcall(struct cache_detail *cd,
142 144
143 ret = nfs_cache_upcall(cd, key->hostname); 145 ret = nfs_cache_upcall(cd, key->hostname);
144 if (ret) 146 if (ret)
145 ret = sunrpc_cache_pipe_upcall(cd, ch, nfs_dns_request); 147 ret = sunrpc_cache_pipe_upcall(cd, ch);
146 return ret; 148 return ret;
147} 149}
148 150
@@ -351,60 +353,47 @@ ssize_t nfs_dns_resolve_name(struct net *net, char *name,
351} 353}
352EXPORT_SYMBOL_GPL(nfs_dns_resolve_name); 354EXPORT_SYMBOL_GPL(nfs_dns_resolve_name);
353 355
356static struct cache_detail nfs_dns_resolve_template = {
357 .owner = THIS_MODULE,
358 .hash_size = NFS_DNS_HASHTBL_SIZE,
359 .name = "dns_resolve",
360 .cache_put = nfs_dns_ent_put,
361 .cache_upcall = nfs_dns_upcall,
362 .cache_request = nfs_dns_request,
363 .cache_parse = nfs_dns_parse,
364 .cache_show = nfs_dns_show,
365 .match = nfs_dns_match,
366 .init = nfs_dns_ent_init,
367 .update = nfs_dns_ent_update,
368 .alloc = nfs_dns_ent_alloc,
369};
370
371
354int nfs_dns_resolver_cache_init(struct net *net) 372int nfs_dns_resolver_cache_init(struct net *net)
355{ 373{
356 int err = -ENOMEM; 374 int err;
357 struct nfs_net *nn = net_generic(net, nfs_net_id); 375 struct nfs_net *nn = net_generic(net, nfs_net_id);
358 struct cache_detail *cd;
359 struct cache_head **tbl;
360 376
361 cd = kzalloc(sizeof(struct cache_detail), GFP_KERNEL); 377 nn->nfs_dns_resolve = cache_create_net(&nfs_dns_resolve_template, net);
362 if (cd == NULL) 378 if (IS_ERR(nn->nfs_dns_resolve))
363 goto err_cd; 379 return PTR_ERR(nn->nfs_dns_resolve);
364 380
365 tbl = kzalloc(NFS_DNS_HASHTBL_SIZE * sizeof(struct cache_head *), 381 err = nfs_cache_register_net(net, nn->nfs_dns_resolve);
366 GFP_KERNEL);
367 if (tbl == NULL)
368 goto err_tbl;
369
370 cd->owner = THIS_MODULE,
371 cd->hash_size = NFS_DNS_HASHTBL_SIZE,
372 cd->hash_table = tbl,
373 cd->name = "dns_resolve",
374 cd->cache_put = nfs_dns_ent_put,
375 cd->cache_upcall = nfs_dns_upcall,
376 cd->cache_parse = nfs_dns_parse,
377 cd->cache_show = nfs_dns_show,
378 cd->match = nfs_dns_match,
379 cd->init = nfs_dns_ent_init,
380 cd->update = nfs_dns_ent_update,
381 cd->alloc = nfs_dns_ent_alloc,
382
383 nfs_cache_init(cd);
384 err = nfs_cache_register_net(net, cd);
385 if (err) 382 if (err)
386 goto err_reg; 383 goto err_reg;
387 nn->nfs_dns_resolve = cd;
388 return 0; 384 return 0;
389 385
390err_reg: 386err_reg:
391 nfs_cache_destroy(cd); 387 cache_destroy_net(nn->nfs_dns_resolve, net);
392 kfree(cd->hash_table);
393err_tbl:
394 kfree(cd);
395err_cd:
396 return err; 388 return err;
397} 389}
398 390
399void nfs_dns_resolver_cache_destroy(struct net *net) 391void nfs_dns_resolver_cache_destroy(struct net *net)
400{ 392{
401 struct nfs_net *nn = net_generic(net, nfs_net_id); 393 struct nfs_net *nn = net_generic(net, nfs_net_id);
402 struct cache_detail *cd = nn->nfs_dns_resolve;
403 394
404 nfs_cache_unregister_net(net, cd); 395 nfs_cache_unregister_net(net, nn->nfs_dns_resolve);
405 nfs_cache_destroy(cd); 396 cache_destroy_net(nn->nfs_dns_resolve, net);
406 kfree(cd->hash_table);
407 kfree(cd);
408} 397}
409 398
410static int rpc_pipefs_event(struct notifier_block *nb, unsigned long event, 399static int rpc_pipefs_event(struct notifier_block *nb, unsigned long event,