aboutsummaryrefslogtreecommitdiffstats
path: root/fs
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
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')
-rw-r--r--fs/lockd/svc4proc.c20
-rw-r--r--fs/lockd/svcproc.c22
2 files changed, 25 insertions, 17 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
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 9cd5c8b37593..88379cc6e0b1 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -113,6 +113,7 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
113{ 113{
114 struct nlm_host *host; 114 struct nlm_host *host;
115 struct nlm_file *file; 115 struct nlm_file *file;
116 int rc = rpc_success;
116 117
117 dprintk("lockd: TEST called\n"); 118 dprintk("lockd: TEST called\n");
118 resp->cookie = argp->cookie; 119 resp->cookie = argp->cookie;
@@ -120,7 +121,7 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
120 /* Don't accept test requests during grace period */ 121 /* Don't accept test requests during grace period */
121 if (nlmsvc_grace_period) { 122 if (nlmsvc_grace_period) {
122 resp->status = nlm_lck_denied_grace_period; 123 resp->status = nlm_lck_denied_grace_period;
123 return rpc_success; 124 return rc;
124 } 125 }
125 126
126 /* Obtain client and file */ 127 /* Obtain client and file */
@@ -130,13 +131,14 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
130 /* Now check for conflicting locks */ 131 /* Now check for conflicting locks */
131 resp->status = cast_status(nlmsvc_testlock(rqstp, file, &argp->lock, &resp->lock, &resp->cookie)); 132 resp->status = cast_status(nlmsvc_testlock(rqstp, file, &argp->lock, &resp->lock, &resp->cookie));
132 if (resp->status == nlm_drop_reply) 133 if (resp->status == nlm_drop_reply)
133 return rpc_drop_reply; 134 rc = rpc_drop_reply;
135 else
136 dprintk("lockd: TEST status %d vers %d\n",
137 ntohl(resp->status), rqstp->rq_vers);
134 138
135 dprintk("lockd: TEST status %d vers %d\n",
136 ntohl(resp->status), rqstp->rq_vers);
137 nlm_release_host(host); 139 nlm_release_host(host);
138 nlm_release_file(file); 140 nlm_release_file(file);
139 return rpc_success; 141 return rc;
140} 142}
141 143
142static __be32 144static __be32
@@ -145,6 +147,7 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
145{ 147{
146 struct nlm_host *host; 148 struct nlm_host *host;
147 struct nlm_file *file; 149 struct nlm_file *file;
150 int rc = rpc_success;
148 151
149 dprintk("lockd: LOCK called\n"); 152 dprintk("lockd: LOCK called\n");
150 153
@@ -153,7 +156,7 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
153 /* Don't accept new lock requests during grace period */ 156 /* Don't accept new lock requests during grace period */
154 if (nlmsvc_grace_period && !argp->reclaim) { 157 if (nlmsvc_grace_period && !argp->reclaim) {
155 resp->status = nlm_lck_denied_grace_period; 158 resp->status = nlm_lck_denied_grace_period;
156 return rpc_success; 159 return rc;
157 } 160 }
158 161
159 /* Obtain client and file */ 162 /* Obtain client and file */
@@ -176,12 +179,13 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
176 resp->status = cast_status(nlmsvc_lock(rqstp, file, &argp->lock, 179 resp->status = cast_status(nlmsvc_lock(rqstp, file, &argp->lock,
177 argp->block, &argp->cookie)); 180 argp->block, &argp->cookie));
178 if (resp->status == nlm_drop_reply) 181 if (resp->status == nlm_drop_reply)
179 return rpc_drop_reply; 182 rc = rpc_drop_reply;
183 else
184 dprintk("lockd: LOCK status %d\n", ntohl(resp->status));
180 185
181 dprintk("lockd: LOCK status %d\n", ntohl(resp->status));
182 nlm_release_host(host); 186 nlm_release_host(host);
183 nlm_release_file(file); 187 nlm_release_file(file);
184 return rpc_success; 188 return rc;
185} 189}
186 190
187static __be32 191static __be32