aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2008-06-10 08:40:35 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2008-06-23 13:02:49 -0400
commitbedbdd8bada194a690d2901801bf8451965086b3 (patch)
treedc7ea15dd52370429bd63cd6803d6402cebbd50b /net
parent0d169ca136357d51a65d686f3c84866a8ba20ae9 (diff)
knfsd: Replace lock_kernel with a mutex for nfsd thread startup/shutdown locking.
This removes the BKL from the RPC service creation codepath. The BKL really isn't adequate for this job since some of this info needs protection across sleeps. Also, add some comments to try and clarify how the locking should work and to make it clear that the BKL isn't necessary as long as there is adequate locking between tasks when touching the svc_serv fields. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/svc.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 01c7e311b904..7bffaff2a3ab 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -461,7 +461,8 @@ svc_create_pooled(struct svc_program *prog, unsigned int bufsize,
461EXPORT_SYMBOL(svc_create_pooled); 461EXPORT_SYMBOL(svc_create_pooled);
462 462
463/* 463/*
464 * Destroy an RPC service. Should be called with the BKL held 464 * Destroy an RPC service. Should be called with appropriate locking to
465 * protect the sv_nrthreads, sv_permsocks and sv_tempsocks.
465 */ 466 */
466void 467void
467svc_destroy(struct svc_serv *serv) 468svc_destroy(struct svc_serv *serv)
@@ -578,9 +579,10 @@ out_enomem:
578EXPORT_SYMBOL(svc_prepare_thread); 579EXPORT_SYMBOL(svc_prepare_thread);
579 580
580/* 581/*
581 * Create a thread in the given pool. Caller must hold BKL. 582 * Create a thread in the given pool. Caller must hold BKL or another lock to
582 * On a NUMA or SMP machine, with a multi-pool serv, the thread 583 * serialize access to the svc_serv struct. On a NUMA or SMP machine, with a
583 * will be restricted to run on the cpus belonging to the pool. 584 * multi-pool serv, the thread will be restricted to run on the cpus belonging
585 * to the pool.
584 */ 586 */
585static int 587static int
586__svc_create_thread(svc_thread_fn func, struct svc_serv *serv, 588__svc_create_thread(svc_thread_fn func, struct svc_serv *serv,
@@ -674,7 +676,7 @@ found_pool:
674 * of threads the given number. If `pool' is non-NULL, applies 676 * of threads the given number. If `pool' is non-NULL, applies
675 * only to threads in that pool, otherwise round-robins between 677 * only to threads in that pool, otherwise round-robins between
676 * all pools. Must be called with a svc_get() reference and 678 * all pools. Must be called with a svc_get() reference and
677 * the BKL held. 679 * the BKL or another lock to protect access to svc_serv fields.
678 * 680 *
679 * Destroying threads relies on the service threads filling in 681 * Destroying threads relies on the service threads filling in
680 * rqstp->rq_task, which only the nfs ones do. Assumes the serv 682 * rqstp->rq_task, which only the nfs ones do. Assumes the serv
@@ -722,7 +724,8 @@ svc_set_num_threads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
722EXPORT_SYMBOL(svc_set_num_threads); 724EXPORT_SYMBOL(svc_set_num_threads);
723 725
724/* 726/*
725 * Called from a server thread as it's exiting. Caller must hold BKL. 727 * Called from a server thread as it's exiting. Caller must hold the BKL or
728 * the "service mutex", whichever is appropriate for the service.
726 */ 729 */
727void 730void
728svc_exit_thread(struct svc_rqst *rqstp) 731svc_exit_thread(struct svc_rqst *rqstp)