diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-03-29 10:54:33 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-04-11 17:55:06 -0400 |
commit | e3f70eadb7dddfb5a2bb9afff7abfc6ee17a29d0 (patch) | |
tree | 688a94f2c86e0d7c637609239925f94f8ee08626 /fs/lockd/clntlock.c | |
parent | f890edbbeff6928b7db0c6179a9036cbd4f0efbf (diff) |
Lockd: pass network namespace to creation and destruction routines
v2: dereference of most probably already released nlm_host removed in
nlmclnt_done() and reclaimer().
These routines are called from locks reclaimer() kernel thread. This thread
works in "init_net" network context and currently relays on persence on lockd
thread and it's per-net resources. Thus lockd_up() and lockd_down() can't relay
on current network context. So let's pass corrent one into them.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/lockd/clntlock.c')
-rw-r--r-- | fs/lockd/clntlock.c | 13 |
1 files changed, 8 insertions, 5 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 | */ |
81 | void nlmclnt_done(struct nlm_host *host) | 81 | void 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 | } |
86 | EXPORT_SYMBOL_GPL(nlmclnt_done); | 88 | EXPORT_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 | } |