aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/svc.c
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2012-04-25 10:23:09 -0400
committerJ. Bruce Fields <bfields@redhat.com>2012-05-31 20:29:44 -0400
commit3d1221dfa95ca876535c5947626f3834343e8fbc (patch)
treee5a9f3d51b287129d9dc2599a524a752a2fdbadd /fs/lockd/svc.c
parent7d13ec761ae45d5e401965c73d855840ff8cdd23 (diff)
LockD: service start function introduced
This is just a code move, which from my POV makes the code look better. I.e. now on start we have 3 different stages: 1) Service creation. 2) Service per-net data allocation. 3) Service start. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/lockd/svc.c')
-rw-r--r--fs/lockd/svc.c67
1 files changed, 42 insertions, 25 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 53cd69ef2add..b47bf7755008 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -291,6 +291,46 @@ static void lockd_down_net(struct svc_serv *serv, struct net *net)
291 } 291 }
292} 292}
293 293
294static int lockd_start_svc(struct svc_serv *serv)
295{
296 int error;
297
298 if (nlmsvc_rqst)
299 return 0;
300
301 /*
302 * Create the kernel thread and wait for it to start.
303 */
304 nlmsvc_rqst = svc_prepare_thread(serv, &serv->sv_pools[0], NUMA_NO_NODE);
305 if (IS_ERR(nlmsvc_rqst)) {
306 error = PTR_ERR(nlmsvc_rqst);
307 printk(KERN_WARNING
308 "lockd_up: svc_rqst allocation failed, error=%d\n",
309 error);
310 goto out_rqst;
311 }
312
313 svc_sock_update_bufs(serv);
314 serv->sv_maxconn = nlm_max_connections;
315
316 nlmsvc_task = kthread_run(lockd, nlmsvc_rqst, serv->sv_name);
317 if (IS_ERR(nlmsvc_task)) {
318 error = PTR_ERR(nlmsvc_task);
319 printk(KERN_WARNING
320 "lockd_up: kthread_run failed, error=%d\n", error);
321 goto out_task;
322 }
323 dprintk("lockd_up: service started\n");
324 return 0;
325
326out_task:
327 svc_exit_thread(nlmsvc_rqst);
328 nlmsvc_task = NULL;
329out_rqst:
330 nlmsvc_rqst = NULL;
331 return error;
332}
333
294static struct svc_serv *lockd_create_svc(void) 334static struct svc_serv *lockd_create_svc(void)
295{ 335{
296 struct svc_serv *serv; 336 struct svc_serv *serv;
@@ -343,32 +383,9 @@ int lockd_up(struct net *net)
343 if (error < 0) 383 if (error < 0)
344 goto err_net; 384 goto err_net;
345 385
346 /* 386 error = lockd_start_svc(serv);
347 * Create the kernel thread and wait for it to start. 387 if (error < 0)
348 */
349 nlmsvc_rqst = svc_prepare_thread(serv, &serv->sv_pools[0], NUMA_NO_NODE);
350 if (IS_ERR(nlmsvc_rqst)) {
351 error = PTR_ERR(nlmsvc_rqst);
352 nlmsvc_rqst = NULL;
353 printk(KERN_WARNING
354 "lockd_up: svc_rqst allocation failed, error=%d\n",
355 error);
356 goto err_start;
357 }
358
359 svc_sock_update_bufs(serv);
360 serv->sv_maxconn = nlm_max_connections;
361
362 nlmsvc_task = kthread_run(lockd, nlmsvc_rqst, serv->sv_name);
363 if (IS_ERR(nlmsvc_task)) {
364 error = PTR_ERR(nlmsvc_task);
365 svc_exit_thread(nlmsvc_rqst);
366 nlmsvc_task = NULL;
367 nlmsvc_rqst = NULL;
368 printk(KERN_WARNING
369 "lockd_up: kthread_run failed, error=%d\n", error);
370 goto err_start; 388 goto err_start;
371 }
372 389
373 nlmsvc_users++; 390 nlmsvc_users++;
374 /* 391 /*