aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/svc4proc.c
diff options
context:
space:
mode:
authorOleg Drokin <green@linuxhacker.ru>2007-11-26 13:35:11 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2008-02-01 16:42:06 -0500
commitb7e6b86948df8d08d420558212e09eb449be9bfa (patch)
treeb9bce0e95a93a6b9142b55c647fb0fbe163a2130 /fs/lockd/svc4proc.c
parent404ec117be5d36e1a4c4582d0c518594333e32df (diff)
lockd: fix reference count leaks in async locking case
In a number of places where we wish only to translate nlm_drop_reply to rpc_drop_reply errors we instead return early with rpc_drop_reply, skipping some important end-of-function cleanup. This results in reference count leaks when lockd is doing posix locking on GFS2. Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/lockd/svc4proc.c')
-rw-r--r--fs/lockd/svc4proc.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index bf27b6c6cb6b..385437e3387d 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -84,6 +84,7 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
84{ 84{
85 struct nlm_host *host; 85 struct nlm_host *host;
86 struct nlm_file *file; 86 struct nlm_file *file;
87 int rc = rpc_success;
87 88
88 dprintk("lockd: TEST4 called\n"); 89 dprintk("lockd: TEST4 called\n");
89 resp->cookie = argp->cookie; 90 resp->cookie = argp->cookie;
@@ -91,7 +92,7 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
91 /* Don't accept test requests during grace period */ 92 /* Don't accept test requests during grace period */
92 if (nlmsvc_grace_period) { 93 if (nlmsvc_grace_period) {
93 resp->status = nlm_lck_denied_grace_period; 94 resp->status = nlm_lck_denied_grace_period;
94 return rpc_success; 95 return rc;
95 } 96 }
96 97
97 /* Obtain client and file */ 98 /* Obtain client and file */
@@ -101,12 +102,13 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
101 /* Now check for conflicting locks */ 102 /* Now check for conflicting locks */
102 resp->status = nlmsvc_testlock(rqstp, file, &argp->lock, &resp->lock, &resp->cookie); 103 resp->status = nlmsvc_testlock(rqstp, file, &argp->lock, &resp->lock, &resp->cookie);
103 if (resp->status == nlm_drop_reply) 104 if (resp->status == nlm_drop_reply)
104 return rpc_drop_reply; 105 rc = rpc_drop_reply;
106 else
107 dprintk("lockd: TEST4 status %d\n", ntohl(resp->status));
105 108
106 dprintk("lockd: TEST4 status %d\n", ntohl(resp->status));
107 nlm_release_host(host); 109 nlm_release_host(host);
108 nlm_release_file(file); 110 nlm_release_file(file);
109 return rpc_success; 111 return rc;
110} 112}
111 113
112static __be32 114static __be32
@@ -115,6 +117,7 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
115{ 117{
116 struct nlm_host *host; 118 struct nlm_host *host;
117 struct nlm_file *file; 119 struct nlm_file *file;
120 int rc = rpc_success;
118 121
119 dprintk("lockd: LOCK called\n"); 122 dprintk("lockd: LOCK called\n");
120 123
@@ -123,7 +126,7 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
123 /* Don't accept new lock requests during grace period */ 126 /* Don't accept new lock requests during grace period */
124 if (nlmsvc_grace_period && !argp->reclaim) { 127 if (nlmsvc_grace_period && !argp->reclaim) {
125 resp->status = nlm_lck_denied_grace_period; 128 resp->status = nlm_lck_denied_grace_period;
126 return rpc_success; 129 return rc;
127 } 130 }
128 131
129 /* Obtain client and file */ 132 /* Obtain client and file */
@@ -146,12 +149,13 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
146 resp->status = nlmsvc_lock(rqstp, file, &argp->lock, 149 resp->status = nlmsvc_lock(rqstp, file, &argp->lock,
147 argp->block, &argp->cookie); 150 argp->block, &argp->cookie);
148 if (resp->status == nlm_drop_reply) 151 if (resp->status == nlm_drop_reply)
149 return rpc_drop_reply; 152 rc = rpc_drop_reply;
153 else
154 dprintk("lockd: LOCK status %d\n", ntohl(resp->status));
150 155
151 dprintk("lockd: LOCK status %d\n", ntohl(resp->status));
152 nlm_release_host(host); 156 nlm_release_host(host);
153 nlm_release_file(file); 157 nlm_release_file(file);
154 return rpc_success; 158 return rc;
155} 159}
156 160
157static __be32 161static __be32