diff options
| author | Chuck Lever <chuck.lever@oracle.com> | 2010-12-14 10:05:42 -0500 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-12-16 12:37:26 -0500 |
| commit | 7db836d4a427c3c64406b00b6d8d745d6335d72a (patch) | |
| tree | 63f1ae586db1945badf8a65e34f49113a4981c5e /fs/lockd | |
| parent | 723bb5b5052faba57060a2feb564ced22416b5bc (diff) | |
lockd: Split nlm_release_call()
The nlm_release_call() function is invoked from both the server and
the client side. We're about to introduce a distinct server- and
client-side nlm_release_host(), so nlm_release_call() must first be
split into a client-side and a server-side version.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/lockd')
| -rw-r--r-- | fs/lockd/clntproc.c | 12 | ||||
| -rw-r--r-- | fs/lockd/svc4proc.c | 4 | ||||
| -rw-r--r-- | fs/lockd/svclock.c | 4 | ||||
| -rw-r--r-- | fs/lockd/svcproc.c | 12 |
4 files changed, 20 insertions, 12 deletions
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 332c54cf75e..fbc6617f76c 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
| @@ -211,7 +211,7 @@ struct nlm_rqst *nlm_alloc_call(struct nlm_host *host) | |||
| 211 | return NULL; | 211 | return NULL; |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | void nlm_release_call(struct nlm_rqst *call) | 214 | void nlmclnt_release_call(struct nlm_rqst *call) |
| 215 | { | 215 | { |
| 216 | if (!atomic_dec_and_test(&call->a_count)) | 216 | if (!atomic_dec_and_test(&call->a_count)) |
| 217 | return; | 217 | return; |
| @@ -222,7 +222,7 @@ void nlm_release_call(struct nlm_rqst *call) | |||
| 222 | 222 | ||
| 223 | static void nlmclnt_rpc_release(void *data) | 223 | static void nlmclnt_rpc_release(void *data) |
| 224 | { | 224 | { |
| 225 | nlm_release_call(data); | 225 | nlmclnt_release_call(data); |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | static int nlm_wait_on_grace(wait_queue_head_t *queue) | 228 | static int nlm_wait_on_grace(wait_queue_head_t *queue) |
| @@ -436,7 +436,7 @@ nlmclnt_test(struct nlm_rqst *req, struct file_lock *fl) | |||
| 436 | status = nlm_stat_to_errno(req->a_res.status); | 436 | status = nlm_stat_to_errno(req->a_res.status); |
| 437 | } | 437 | } |
| 438 | out: | 438 | out: |
| 439 | nlm_release_call(req); | 439 | nlmclnt_release_call(req); |
| 440 | return status; | 440 | return status; |
| 441 | } | 441 | } |
| 442 | 442 | ||
| @@ -593,7 +593,7 @@ again: | |||
| 593 | out_unblock: | 593 | out_unblock: |
| 594 | nlmclnt_finish_block(block); | 594 | nlmclnt_finish_block(block); |
| 595 | out: | 595 | out: |
| 596 | nlm_release_call(req); | 596 | nlmclnt_release_call(req); |
| 597 | return status; | 597 | return status; |
| 598 | out_unlock: | 598 | out_unlock: |
| 599 | /* Fatal error: ensure that we remove the lock altogether */ | 599 | /* Fatal error: ensure that we remove the lock altogether */ |
| @@ -694,7 +694,7 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl) | |||
| 694 | /* What to do now? I'm out of my depth... */ | 694 | /* What to do now? I'm out of my depth... */ |
| 695 | status = -ENOLCK; | 695 | status = -ENOLCK; |
| 696 | out: | 696 | out: |
| 697 | nlm_release_call(req); | 697 | nlmclnt_release_call(req); |
| 698 | return status; | 698 | return status; |
| 699 | } | 699 | } |
| 700 | 700 | ||
| @@ -755,7 +755,7 @@ static int nlmclnt_cancel(struct nlm_host *host, int block, struct file_lock *fl | |||
| 755 | NLMPROC_CANCEL, &nlmclnt_cancel_ops); | 755 | NLMPROC_CANCEL, &nlmclnt_cancel_ops); |
| 756 | if (status == 0 && req->a_res.status == nlm_lck_denied) | 756 | if (status == 0 && req->a_res.status == nlm_lck_denied) |
| 757 | status = -ENOLCK; | 757 | status = -ENOLCK; |
| 758 | nlm_release_call(req); | 758 | nlmclnt_release_call(req); |
| 759 | return status; | 759 | return status; |
| 760 | } | 760 | } |
| 761 | 761 | ||
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index 38d26119245..c187422026d 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c | |||
| @@ -229,7 +229,7 @@ static void nlm4svc_callback_exit(struct rpc_task *task, void *data) | |||
| 229 | 229 | ||
| 230 | static void nlm4svc_callback_release(void *data) | 230 | static void nlm4svc_callback_release(void *data) |
| 231 | { | 231 | { |
| 232 | nlm_release_call(data); | 232 | nlmsvc_release_call(data); |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | static const struct rpc_call_ops nlm4svc_callback_ops = { | 235 | static const struct rpc_call_ops nlm4svc_callback_ops = { |
| @@ -261,7 +261,7 @@ static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args | |||
| 261 | 261 | ||
| 262 | stat = func(rqstp, argp, &call->a_res); | 262 | stat = func(rqstp, argp, &call->a_res); |
| 263 | if (stat != 0) { | 263 | if (stat != 0) { |
| 264 | nlm_release_call(call); | 264 | nlmsvc_release_call(call); |
| 265 | return stat; | 265 | return stat; |
| 266 | } | 266 | } |
| 267 | 267 | ||
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 9266c460020..6e31695d046 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
| @@ -234,7 +234,7 @@ nlmsvc_create_block(struct svc_rqst *rqstp, struct nlm_host *host, | |||
| 234 | failed_free: | 234 | failed_free: |
| 235 | kfree(block); | 235 | kfree(block); |
| 236 | failed: | 236 | failed: |
| 237 | nlm_release_call(call); | 237 | nlmsvc_release_call(call); |
| 238 | return NULL; | 238 | return NULL; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| @@ -267,7 +267,7 @@ static void nlmsvc_free_block(struct kref *kref) | |||
| 267 | mutex_unlock(&file->f_mutex); | 267 | mutex_unlock(&file->f_mutex); |
| 268 | 268 | ||
| 269 | nlmsvc_freegrantargs(block->b_call); | 269 | nlmsvc_freegrantargs(block->b_call); |
| 270 | nlm_release_call(block->b_call); | 270 | nlmsvc_release_call(block->b_call); |
| 271 | nlm_release_file(block->b_file); | 271 | nlm_release_file(block->b_file); |
| 272 | kfree(block->b_fl); | 272 | kfree(block->b_fl); |
| 273 | kfree(block); | 273 | kfree(block); |
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index 0caea5310ac..0df65ec29e4 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c | |||
| @@ -257,9 +257,17 @@ static void nlmsvc_callback_exit(struct rpc_task *task, void *data) | |||
| 257 | -task->tk_status); | 257 | -task->tk_status); |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | void nlmsvc_release_call(struct nlm_rqst *call) | ||
| 261 | { | ||
| 262 | if (!atomic_dec_and_test(&call->a_count)) | ||
| 263 | return; | ||
| 264 | nlm_release_host(call->a_host); | ||
| 265 | kfree(call); | ||
| 266 | } | ||
| 267 | |||
| 260 | static void nlmsvc_callback_release(void *data) | 268 | static void nlmsvc_callback_release(void *data) |
| 261 | { | 269 | { |
| 262 | nlm_release_call(data); | 270 | nlmsvc_release_call(data); |
| 263 | } | 271 | } |
| 264 | 272 | ||
| 265 | static const struct rpc_call_ops nlmsvc_callback_ops = { | 273 | static const struct rpc_call_ops nlmsvc_callback_ops = { |
| @@ -291,7 +299,7 @@ static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args | |||
| 291 | 299 | ||
| 292 | stat = func(rqstp, argp, &call->a_res); | 300 | stat = func(rqstp, argp, &call->a_res); |
| 293 | if (stat != 0) { | 301 | if (stat != 0) { |
| 294 | nlm_release_call(call); | 302 | nlmsvc_release_call(call); |
| 295 | return stat; | 303 | return stat; |
| 296 | } | 304 | } |
| 297 | 305 | ||
