Commit 9222b955065dbb047b8db9eb2431979bff3ce700

Authored by Stanislav Kinsbursky
Committed by Trond Myklebust
1 parent 820f9442e7

NFS: split cache creation and PipeFS registration

This precursor patch splits NFS cache creation and PipeFS registartion.
It's required for latter split of NFS DNS resolver cache creation per network
namespace context and PipeFS registration/unregistration on MOUNT/UMOUNT
events.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

Showing 3 changed files with 21 additions and 3 deletions Side-by-side Diff

... ... @@ -120,7 +120,6 @@
120 120 mnt = rpc_get_mount();
121 121 if (IS_ERR(mnt))
122 122 return PTR_ERR(mnt);
123   - sunrpc_init_cache_detail(cd);
124 123 ret = vfs_path_lookup(mnt->mnt_root, mnt, "/cache", 0, &path);
125 124 if (ret)
126 125 goto err;
... ... @@ -129,7 +128,6 @@
129 128 if (!ret)
130 129 return ret;
131 130 err:
132   - sunrpc_destroy_cache_detail(cd);
133 131 rpc_put_mount();
134 132 return ret;
135 133 }
... ... @@ -139,5 +137,15 @@
139 137 sunrpc_cache_unregister_pipefs(cd);
140 138 sunrpc_destroy_cache_detail(cd);
141 139 rpc_put_mount();
  140 +}
  141 +
  142 +void nfs_cache_init(struct cache_detail *cd)
  143 +{
  144 + sunrpc_init_cache_detail(cd);
  145 +}
  146 +
  147 +void nfs_cache_destroy(struct cache_detail *cd)
  148 +{
  149 + sunrpc_destroy_cache_detail(cd);
142 150 }
... ... @@ -23,6 +23,8 @@
23 23 extern void nfs_cache_defer_req_put(struct nfs_cache_defer_req *dreq);
24 24 extern int nfs_cache_wait_for_upcall(struct nfs_cache_defer_req *dreq);
25 25  
  26 +extern void nfs_cache_init(struct cache_detail *cd);
  27 +extern void nfs_cache_destroy(struct cache_detail *cd);
26 28 extern int nfs_cache_register(struct cache_detail *cd);
27 29 extern void nfs_cache_unregister(struct cache_detail *cd);
fs/nfs/dns_resolve.c
... ... @@ -361,12 +361,21 @@
361 361  
362 362 int nfs_dns_resolver_init(void)
363 363 {
364   - return nfs_cache_register(&nfs_dns_resolve);
  364 + int err;
  365 +
  366 + nfs_cache_init(&nfs_dns_resolve);
  367 + err = nfs_cache_register(&nfs_dns_resolve);
  368 + if (err) {
  369 + nfs_cache_destroy(&nfs_dns_resolve);
  370 + return err;
  371 + }
  372 + return 0;
365 373 }
366 374  
367 375 void nfs_dns_resolver_destroy(void)
368 376 {
369 377 nfs_cache_unregister(&nfs_dns_resolve);
  378 + nfs_cache_destroy(&nfs_dns_resolve);
370 379 }
371 380  
372 381 #endif