diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-25 16:39:50 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-29 15:09:57 -0400 |
commit | 446945ab9a82515af4b099107eda27050e077c58 (patch) | |
tree | 1be9a17759fc754d44a10549a2b43a5aa84a8e2f /fs | |
parent | a51d9eaa41866ab6b4b6ecad7b621f8b66ece0dc (diff) |
lockd: shift grabbing a reference to nlm_host into nlm_alloc_call()
It's used both for client and server hosts; we can't do nlmclnt_release_host()
on failure exits, since the host might need nlmsvc_release_host(), with BUG_ON()
for calling the wrong one. Makes life simpler for callers, actually...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/lockd/clntproc.c | 9 | ||||
-rw-r--r-- | fs/lockd/svc4proc.c | 1 | ||||
-rw-r--r-- | fs/lockd/svclock.c | 1 | ||||
-rw-r--r-- | fs/lockd/svcproc.c | 1 |
4 files changed, 4 insertions, 8 deletions
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 8392cb85bd54..27c74f32671b 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
@@ -156,7 +156,6 @@ int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl) | |||
156 | struct nlm_rqst *call; | 156 | struct nlm_rqst *call; |
157 | int status; | 157 | int status; |
158 | 158 | ||
159 | nlm_get_host(host); | ||
160 | call = nlm_alloc_call(host); | 159 | call = nlm_alloc_call(host); |
161 | if (call == NULL) | 160 | if (call == NULL) |
162 | return -ENOMEM; | 161 | return -ENOMEM; |
@@ -185,9 +184,6 @@ EXPORT_SYMBOL_GPL(nlmclnt_proc); | |||
185 | 184 | ||
186 | /* | 185 | /* |
187 | * Allocate an NLM RPC call struct | 186 | * Allocate an NLM RPC call struct |
188 | * | ||
189 | * Note: the caller must hold a reference to host. In case of failure, | ||
190 | * this reference will be released. | ||
191 | */ | 187 | */ |
192 | struct nlm_rqst *nlm_alloc_call(struct nlm_host *host) | 188 | struct nlm_rqst *nlm_alloc_call(struct nlm_host *host) |
193 | { | 189 | { |
@@ -199,7 +195,7 @@ struct nlm_rqst *nlm_alloc_call(struct nlm_host *host) | |||
199 | atomic_set(&call->a_count, 1); | 195 | atomic_set(&call->a_count, 1); |
200 | locks_init_lock(&call->a_args.lock.fl); | 196 | locks_init_lock(&call->a_args.lock.fl); |
201 | locks_init_lock(&call->a_res.lock.fl); | 197 | locks_init_lock(&call->a_res.lock.fl); |
202 | call->a_host = host; | 198 | call->a_host = nlm_get_host(host); |
203 | return call; | 199 | return call; |
204 | } | 200 | } |
205 | if (signalled()) | 201 | if (signalled()) |
@@ -207,7 +203,6 @@ struct nlm_rqst *nlm_alloc_call(struct nlm_host *host) | |||
207 | printk("nlm_alloc_call: failed, waiting for memory\n"); | 203 | printk("nlm_alloc_call: failed, waiting for memory\n"); |
208 | schedule_timeout_interruptible(5*HZ); | 204 | schedule_timeout_interruptible(5*HZ); |
209 | } | 205 | } |
210 | nlmclnt_release_host(host); | ||
211 | return NULL; | 206 | return NULL; |
212 | } | 207 | } |
213 | 208 | ||
@@ -750,7 +745,7 @@ static int nlmclnt_cancel(struct nlm_host *host, int block, struct file_lock *fl | |||
750 | dprintk("lockd: blocking lock attempt was interrupted by a signal.\n" | 745 | dprintk("lockd: blocking lock attempt was interrupted by a signal.\n" |
751 | " Attempting to cancel lock.\n"); | 746 | " Attempting to cancel lock.\n"); |
752 | 747 | ||
753 | req = nlm_alloc_call(nlm_get_host(host)); | 748 | req = nlm_alloc_call(host); |
754 | if (!req) | 749 | if (!req) |
755 | return -ENOMEM; | 750 | return -ENOMEM; |
756 | req->a_flags = RPC_TASK_ASYNC; | 751 | req->a_flags = RPC_TASK_ASYNC; |
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index 9a41fdc19511..185fda894789 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c | |||
@@ -256,6 +256,7 @@ static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args | |||
256 | return rpc_system_err; | 256 | return rpc_system_err; |
257 | 257 | ||
258 | call = nlm_alloc_call(host); | 258 | call = nlm_alloc_call(host); |
259 | nlmsvc_release_host(host); | ||
259 | if (call == NULL) | 260 | if (call == NULL) |
260 | return rpc_system_err; | 261 | return rpc_system_err; |
261 | 262 | ||
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index e46353f41a42..b54acaf65987 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
@@ -219,7 +219,6 @@ nlmsvc_create_block(struct svc_rqst *rqstp, struct nlm_host *host, | |||
219 | struct nlm_block *block; | 219 | struct nlm_block *block; |
220 | struct nlm_rqst *call = NULL; | 220 | struct nlm_rqst *call = NULL; |
221 | 221 | ||
222 | nlm_get_host(host); | ||
223 | call = nlm_alloc_call(host); | 222 | call = nlm_alloc_call(host); |
224 | if (call == NULL) | 223 | if (call == NULL) |
225 | return NULL; | 224 | return NULL; |
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index d27aab11f324..90cfe9a0bf55 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c | |||
@@ -294,6 +294,7 @@ static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args | |||
294 | return rpc_system_err; | 294 | return rpc_system_err; |
295 | 295 | ||
296 | call = nlm_alloc_call(host); | 296 | call = nlm_alloc_call(host); |
297 | nlmsvc_release_host(host); | ||
297 | if (call == NULL) | 298 | if (call == NULL) |
298 | return rpc_system_err; | 299 | return rpc_system_err; |
299 | 300 | ||