aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfssvc.c36
1 files changed, 5 insertions, 31 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 9773f593b3ff..0029cb290f18 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -57,12 +57,6 @@ static atomic_t nfsd_busy;
57static unsigned long nfsd_last_call; 57static unsigned long nfsd_last_call;
58static DEFINE_SPINLOCK(nfsd_call_lock); 58static DEFINE_SPINLOCK(nfsd_call_lock);
59 59
60struct nfsd_list {
61 struct list_head list;
62 struct task_struct *task;
63};
64static struct list_head nfsd_list = LIST_HEAD_INIT(nfsd_list);
65
66#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 60#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
67static struct svc_stat nfsd_acl_svcstats; 61static struct svc_stat nfsd_acl_svcstats;
68static struct svc_version * nfsd_acl_version[] = { 62static struct svc_version * nfsd_acl_version[] = {
@@ -206,8 +200,9 @@ int nfsd_create_serv(void)
206 } 200 }
207 201
208 atomic_set(&nfsd_busy, 0); 202 atomic_set(&nfsd_busy, 0);
209 nfsd_serv = svc_create(&nfsd_program, NFSD_BUFSIZE, 203 nfsd_serv = svc_create_pooled(&nfsd_program, NFSD_BUFSIZE,
210 nfsd_last_thread); 204 nfsd_last_thread,
205 nfsd, SIG_NOCLEAN, THIS_MODULE);
211 if (nfsd_serv == NULL) 206 if (nfsd_serv == NULL)
212 err = -ENOMEM; 207 err = -ENOMEM;
213 unlock_kernel(); 208 unlock_kernel();
@@ -247,7 +242,6 @@ int
247nfsd_svc(unsigned short port, int nrservs) 242nfsd_svc(unsigned short port, int nrservs)
248{ 243{
249 int error; 244 int error;
250 struct list_head *victim;
251 245
252 lock_kernel(); 246 lock_kernel();
253 dprintk("nfsd: creating service\n"); 247 dprintk("nfsd: creating service\n");
@@ -275,24 +269,7 @@ nfsd_svc(unsigned short port, int nrservs)
275 if (error) 269 if (error)
276 goto failure; 270 goto failure;
277 271
278 nrservs -= (nfsd_serv->sv_nrthreads-1); 272 error = svc_set_num_threads(nfsd_serv, NULL, nrservs);
279 while (nrservs > 0) {
280 nrservs--;
281 __module_get(THIS_MODULE);
282 error = svc_create_thread(nfsd, nfsd_serv);
283 if (error < 0) {
284 module_put(THIS_MODULE);
285 break;
286 }
287 }
288 victim = nfsd_list.next;
289 while (nrservs < 0 && victim != &nfsd_list) {
290 struct nfsd_list *nl =
291 list_entry(victim,struct nfsd_list, list);
292 victim = victim->next;
293 send_sig(SIG_NOCLEAN, nl->task, 1);
294 nrservs++;
295 }
296 failure: 273 failure:
297 svc_destroy(nfsd_serv); /* Release server */ 274 svc_destroy(nfsd_serv); /* Release server */
298 out: 275 out:
@@ -329,7 +306,6 @@ nfsd(struct svc_rqst *rqstp)
329{ 306{
330 struct fs_struct *fsp; 307 struct fs_struct *fsp;
331 int err; 308 int err;
332 struct nfsd_list me;
333 sigset_t shutdown_mask, allowed_mask; 309 sigset_t shutdown_mask, allowed_mask;
334 310
335 /* Lock module and set up kernel thread */ 311 /* Lock module and set up kernel thread */
@@ -353,8 +329,7 @@ nfsd(struct svc_rqst *rqstp)
353 329
354 nfsdstats.th_cnt++; 330 nfsdstats.th_cnt++;
355 331
356 me.task = current; 332 rqstp->rq_task = current;
357 list_add(&me.list, &nfsd_list);
358 333
359 unlock_kernel(); 334 unlock_kernel();
360 335
@@ -413,7 +388,6 @@ nfsd(struct svc_rqst *rqstp)
413 388
414 lock_kernel(); 389 lock_kernel();
415 390
416 list_del(&me.list);
417 nfsdstats.th_cnt --; 391 nfsdstats.th_cnt --;
418 392
419out: 393out: