summaryrefslogtreecommitdiffstats
path: root/fs/lockd
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-04-01 18:58:49 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-04-19 16:53:36 -0400
commit5e7f37a76fa5b604949020b7317962262812b2dd (patch)
treeceb12f296c0d19374993ac33f306180c1f8dc23a /fs/lockd
parent536ff0f809b0f4d56e1c41e66768d330668e0a55 (diff)
downloadlinux-5e7f37a76fa5b604949020b7317962262812b2dd.tar.gz
linux-5e7f37a76fa5b604949020b7317962262812b2dd.tar.bz2
linux-5e7f37a76fa5b604949020b7317962262812b2dd.zip
NLM/lockd: Add a reference counter to struct nlm_rqst
When we replace the existing synchronous RPC calls with asynchronous calls, the reference count will be needed in order to allow us to examine the result of the RPC call. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/lockd')
-rw-r--r--fs/lockd/clntproc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index 4e1c0123b45d..749eb5328cb0 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -221,6 +221,7 @@ struct nlm_rqst *nlm_alloc_call(struct nlm_host *host)
for(;;) {
call = kzalloc(sizeof(*call), GFP_KERNEL);
if (call != NULL) {
+ atomic_set(&call->a_count, 1);
locks_init_lock(&call->a_args.lock.fl);
locks_init_lock(&call->a_res.lock.fl);
call->a_host = host;
@@ -237,6 +238,8 @@ struct nlm_rqst *nlm_alloc_call(struct nlm_host *host)
void nlm_release_call(struct nlm_rqst *call)
{
+ if (!atomic_dec_and_test(&call->a_count))
+ return;
nlm_release_host(call->a_host);
nlmclnt_release_lockargs(call);
kfree(call);