aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-31 21:18:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-31 21:18:11 -0400
commita00b6151a2ae4c52576c35d3998e144a993d50b8 (patch)
treefc312be05c4deb4dead7a6afa09e88017d3a0146 /fs/lockd
parent08615d7d85e5aa02c05bf6c4dde87d940e7f85f6 (diff)
parentb108fe6b08f3f61c2c465649b20b7d4b4c185728 (diff)
Merge branch 'for-3.5-take-2' of git://linux-nfs.org/~bfields/linux
Pull nfsd update from Bruce Fields. * 'for-3.5-take-2' of git://linux-nfs.org/~bfields/linux: (23 commits) nfsd: trivial: use SEEK_SET instead of 0 in vfs_llseek SUNRPC: split upcall function to extract reusable parts nfsd: allocate id-to-name and name-to-id caches in per-net operations. nfsd: make name-to-id cache allocated per network namespace context nfsd: make id-to-name cache allocated per network namespace context nfsd: pass network context to idmap init/exit functions nfsd: allocate export and expkey caches in per-net operations. nfsd: make expkey cache allocated per network namespace context nfsd: make export cache allocated per network namespace context nfsd: pass pointer to export cache down to stack wherever possible. nfsd: pass network context to export caches init/shutdown routines Lockd: pass network namespace to creation and destruction routines NFSd: remove hard-coded dereferences to name-to-id and id-to-name caches nfsd: pass pointer to expkey cache down to stack wherever possible. nfsd: use hash table from cache detail in nfsd export seq ops nfsd: pass svc_export_cache pointer as private data to "exports" seq file ops nfsd: use exp_put() for svc_export_cache put nfsd: use cache detail pointer from svc_export structure on cache put nfsd: add link to owner cache detail to svc_export structure nfsd: use passed cache_detail pointer expkey_parse() ...
Diffstat (limited to 'fs/lockd')
-rw-r--r--fs/lockd/clntlock.c13
-rw-r--r--fs/lockd/svc.c7
2 files changed, 11 insertions, 9 deletions
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
index ba1dc2eebd1e..ca0a08001449 100644
--- a/fs/lockd/clntlock.c
+++ b/fs/lockd/clntlock.c
@@ -56,7 +56,7 @@ struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init)
56 u32 nlm_version = (nlm_init->nfs_version == 2) ? 1 : 4; 56 u32 nlm_version = (nlm_init->nfs_version == 2) ? 1 : 4;
57 int status; 57 int status;
58 58
59 status = lockd_up(); 59 status = lockd_up(nlm_init->net);
60 if (status < 0) 60 if (status < 0)
61 return ERR_PTR(status); 61 return ERR_PTR(status);
62 62
@@ -65,7 +65,7 @@ struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init)
65 nlm_init->hostname, nlm_init->noresvport, 65 nlm_init->hostname, nlm_init->noresvport,
66 nlm_init->net); 66 nlm_init->net);
67 if (host == NULL) { 67 if (host == NULL) {
68 lockd_down(); 68 lockd_down(nlm_init->net);
69 return ERR_PTR(-ENOLCK); 69 return ERR_PTR(-ENOLCK);
70 } 70 }
71 71
@@ -80,8 +80,10 @@ EXPORT_SYMBOL_GPL(nlmclnt_init);
80 */ 80 */
81void nlmclnt_done(struct nlm_host *host) 81void nlmclnt_done(struct nlm_host *host)
82{ 82{
83 struct net *net = host->net;
84
83 nlmclnt_release_host(host); 85 nlmclnt_release_host(host);
84 lockd_down(); 86 lockd_down(net);
85} 87}
86EXPORT_SYMBOL_GPL(nlmclnt_done); 88EXPORT_SYMBOL_GPL(nlmclnt_done);
87 89
@@ -220,11 +222,12 @@ reclaimer(void *ptr)
220 struct nlm_wait *block; 222 struct nlm_wait *block;
221 struct file_lock *fl, *next; 223 struct file_lock *fl, *next;
222 u32 nsmstate; 224 u32 nsmstate;
225 struct net *net = host->net;
223 226
224 allow_signal(SIGKILL); 227 allow_signal(SIGKILL);
225 228
226 down_write(&host->h_rwsem); 229 down_write(&host->h_rwsem);
227 lockd_up(); /* note: this cannot fail as lockd is already running */ 230 lockd_up(net); /* note: this cannot fail as lockd is already running */
228 231
229 dprintk("lockd: reclaiming locks for host %s\n", host->h_name); 232 dprintk("lockd: reclaiming locks for host %s\n", host->h_name);
230 233
@@ -275,6 +278,6 @@ restart:
275 278
276 /* Release host handle after use */ 279 /* Release host handle after use */
277 nlmclnt_release_host(host); 280 nlmclnt_release_host(host);
278 lockd_down(); 281 lockd_down(net);
279 return 0; 282 return 0;
280} 283}
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index f49b9afc4436..1ead0750cdbb 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -295,11 +295,10 @@ static void lockd_down_net(struct net *net)
295/* 295/*
296 * Bring up the lockd process if it's not already up. 296 * Bring up the lockd process if it's not already up.
297 */ 297 */
298int lockd_up(void) 298int lockd_up(struct net *net)
299{ 299{
300 struct svc_serv *serv; 300 struct svc_serv *serv;
301 int error = 0; 301 int error = 0;
302 struct net *net = current->nsproxy->net_ns;
303 302
304 mutex_lock(&nlmsvc_mutex); 303 mutex_lock(&nlmsvc_mutex);
305 /* 304 /*
@@ -378,12 +377,12 @@ EXPORT_SYMBOL_GPL(lockd_up);
378 * Decrement the user count and bring down lockd if we're the last. 377 * Decrement the user count and bring down lockd if we're the last.
379 */ 378 */
380void 379void
381lockd_down(void) 380lockd_down(struct net *net)
382{ 381{
383 mutex_lock(&nlmsvc_mutex); 382 mutex_lock(&nlmsvc_mutex);
384 if (nlmsvc_users) { 383 if (nlmsvc_users) {
385 if (--nlmsvc_users) { 384 if (--nlmsvc_users) {
386 lockd_down_net(current->nsproxy->net_ns); 385 lockd_down_net(net);
387 goto out; 386 goto out;
388 } 387 }
389 } else { 388 } else {