Commit 7db836d4 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

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: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 723bb5b5
...@@ -211,7 +211,7 @@ struct nlm_rqst *nlm_alloc_call(struct nlm_host *host) ...@@ -211,7 +211,7 @@ struct nlm_rqst *nlm_alloc_call(struct nlm_host *host)
return NULL; return NULL;
} }
void nlm_release_call(struct nlm_rqst *call) void nlmclnt_release_call(struct nlm_rqst *call)
{ {
if (!atomic_dec_and_test(&call->a_count)) if (!atomic_dec_and_test(&call->a_count))
return; return;
...@@ -222,7 +222,7 @@ void nlm_release_call(struct nlm_rqst *call) ...@@ -222,7 +222,7 @@ void nlm_release_call(struct nlm_rqst *call)
static void nlmclnt_rpc_release(void *data) static void nlmclnt_rpc_release(void *data)
{ {
nlm_release_call(data); nlmclnt_release_call(data);
} }
static int nlm_wait_on_grace(wait_queue_head_t *queue) 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,7 +436,7 @@ nlmclnt_test(struct nlm_rqst *req, struct file_lock *fl)
status = nlm_stat_to_errno(req->a_res.status); status = nlm_stat_to_errno(req->a_res.status);
} }
out: out:
nlm_release_call(req); nlmclnt_release_call(req);
return status; return status;
} }
...@@ -593,7 +593,7 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl) ...@@ -593,7 +593,7 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
out_unblock: out_unblock:
nlmclnt_finish_block(block); nlmclnt_finish_block(block);
out: out:
nlm_release_call(req); nlmclnt_release_call(req);
return status; return status;
out_unlock: out_unlock:
/* Fatal error: ensure that we remove the lock altogether */ /* Fatal error: ensure that we remove the lock altogether */
...@@ -694,7 +694,7 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl) ...@@ -694,7 +694,7 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)
/* What to do now? I'm out of my depth... */ /* What to do now? I'm out of my depth... */
status = -ENOLCK; status = -ENOLCK;
out: out:
nlm_release_call(req); nlmclnt_release_call(req);
return status; return status;
} }
...@@ -755,7 +755,7 @@ static int nlmclnt_cancel(struct nlm_host *host, int block, struct file_lock *fl ...@@ -755,7 +755,7 @@ static int nlmclnt_cancel(struct nlm_host *host, int block, struct file_lock *fl
NLMPROC_CANCEL, &nlmclnt_cancel_ops); NLMPROC_CANCEL, &nlmclnt_cancel_ops);
if (status == 0 && req->a_res.status == nlm_lck_denied) if (status == 0 && req->a_res.status == nlm_lck_denied)
status = -ENOLCK; status = -ENOLCK;
nlm_release_call(req); nlmclnt_release_call(req);
return status; return status;
} }
......
...@@ -229,7 +229,7 @@ static void nlm4svc_callback_exit(struct rpc_task *task, void *data) ...@@ -229,7 +229,7 @@ static void nlm4svc_callback_exit(struct rpc_task *task, void *data)
static void nlm4svc_callback_release(void *data) static void nlm4svc_callback_release(void *data)
{ {
nlm_release_call(data); nlmsvc_release_call(data);
} }
static const struct rpc_call_ops nlm4svc_callback_ops = { 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,7 +261,7 @@ static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args
stat = func(rqstp, argp, &call->a_res); stat = func(rqstp, argp, &call->a_res);
if (stat != 0) { if (stat != 0) {
nlm_release_call(call); nlmsvc_release_call(call);
return stat; return stat;
} }
......
...@@ -234,7 +234,7 @@ nlmsvc_create_block(struct svc_rqst *rqstp, struct nlm_host *host, ...@@ -234,7 +234,7 @@ nlmsvc_create_block(struct svc_rqst *rqstp, struct nlm_host *host,
failed_free: failed_free:
kfree(block); kfree(block);
failed: failed:
nlm_release_call(call); nlmsvc_release_call(call);
return NULL; return NULL;
} }
...@@ -267,7 +267,7 @@ static void nlmsvc_free_block(struct kref *kref) ...@@ -267,7 +267,7 @@ static void nlmsvc_free_block(struct kref *kref)
mutex_unlock(&file->f_mutex); mutex_unlock(&file->f_mutex);
nlmsvc_freegrantargs(block->b_call); nlmsvc_freegrantargs(block->b_call);
nlm_release_call(block->b_call); nlmsvc_release_call(block->b_call);
nlm_release_file(block->b_file); nlm_release_file(block->b_file);
kfree(block->b_fl); kfree(block->b_fl);
kfree(block); kfree(block);
......
...@@ -257,9 +257,17 @@ static void nlmsvc_callback_exit(struct rpc_task *task, void *data) ...@@ -257,9 +257,17 @@ static void nlmsvc_callback_exit(struct rpc_task *task, void *data)
-task->tk_status); -task->tk_status);
} }
void nlmsvc_release_call(struct nlm_rqst *call)
{
if (!atomic_dec_and_test(&call->a_count))
return;
nlm_release_host(call->a_host);
kfree(call);
}
static void nlmsvc_callback_release(void *data) static void nlmsvc_callback_release(void *data)
{ {
nlm_release_call(data); nlmsvc_release_call(data);
} }
static const struct rpc_call_ops nlmsvc_callback_ops = { 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,7 +299,7 @@ static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args
stat = func(rqstp, argp, &call->a_res); stat = func(rqstp, argp, &call->a_res);
if (stat != 0) { if (stat != 0) {
nlm_release_call(call); nlmsvc_release_call(call);
return stat; return stat;
} }
......
...@@ -202,9 +202,9 @@ extern u32 nsm_local_state; ...@@ -202,9 +202,9 @@ extern u32 nsm_local_state;
* Lockd client functions * Lockd client functions
*/ */
struct nlm_rqst * nlm_alloc_call(struct nlm_host *host); struct nlm_rqst * nlm_alloc_call(struct nlm_host *host);
void nlm_release_call(struct nlm_rqst *);
int nlm_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *); int nlm_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *);
int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *); int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *);
void nlmclnt_release_call(struct nlm_rqst *);
struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl); struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl);
void nlmclnt_finish_block(struct nlm_wait *block); void nlmclnt_finish_block(struct nlm_wait *block);
int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout); int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout);
...@@ -267,6 +267,7 @@ unsigned long nlmsvc_retry_blocked(void); ...@@ -267,6 +267,7 @@ unsigned long nlmsvc_retry_blocked(void);
void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
nlm_host_match_fn_t match); nlm_host_match_fn_t match);
void nlmsvc_grant_reply(struct nlm_cookie *, __be32); void nlmsvc_grant_reply(struct nlm_cookie *, __be32);
void nlmsvc_release_call(struct nlm_rqst *);
/* /*
* File handling for the server personality * File handling for the server personality
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment