aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-10-02 05:17:45 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 10:57:17 -0400
commit24e36663c375df577d2dcae437713481ffd6850c (patch)
treedd738e582b663c433eef3a53eb593a518439a285 /fs/nfsd
parentbc591ccff27e6a85d3a0d6fcb16cfadcc45267a8 (diff)
[PATCH] knfsd: be more selective in which sockets lockd listens on
Currently lockd listens on UDP always, and TCP if CONFIG_NFSD_TCP is set. However as lockd performs services of the client as well, this is a problem. If CONFIG_NfSD_TCP is not set, and a tcp mount is used, the server will not be able to call back to lockd. So: - add an option to lockd_up saying which protocol is needed - Always open sockets for which an explicit port was given, otherwise only open a socket of the type required - Change nfsd to do one lockd_up per socket rather than one per thread. This - removes the dependancy on CONFIG_NFSD_TCP - means that lockd may open sockets other than at startup - means that lockd will *not* listen on UDP if the only mounts are TCP mount (and nfsd hasn't started). The latter is the only one that concerns me at all - I don't know if this might be a problem with some servers. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfssvc.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index c52c99964a4c..0339b4ddfa3b 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -134,6 +134,9 @@ static int killsig; /* signal that was used to kill last nfsd */
134static void nfsd_last_thread(struct svc_serv *serv) 134static void nfsd_last_thread(struct svc_serv *serv)
135{ 135{
136 /* When last nfsd thread exits we need to do some clean-up */ 136 /* When last nfsd thread exits we need to do some clean-up */
137 struct svc_sock *svsk;
138 list_for_each_entry(svsk, &serv->sv_permsocks, sk_list)
139 lockd_down();
137 nfsd_serv = NULL; 140 nfsd_serv = NULL;
138 nfsd_racache_shutdown(); 141 nfsd_racache_shutdown();
139 nfs4_state_shutdown(); 142 nfs4_state_shutdown();
@@ -218,11 +221,16 @@ nfsd_svc(unsigned short port, int nrservs)
218 error = svc_makesock(nfsd_serv, IPPROTO_UDP, port); 221 error = svc_makesock(nfsd_serv, IPPROTO_UDP, port);
219 if (error < 0) 222 if (error < 0)
220 goto failure; 223 goto failure;
221 224 error = lockd_up(IPPROTO_UDP);
225 if (error < 0)
226 goto failure;
222#ifdef CONFIG_NFSD_TCP 227#ifdef CONFIG_NFSD_TCP
223 error = svc_makesock(nfsd_serv, IPPROTO_TCP, port); 228 error = svc_makesock(nfsd_serv, IPPROTO_TCP, port);
224 if (error < 0) 229 if (error < 0)
225 goto failure; 230 goto failure;
231 error = lockd_up(IPPROTO_TCP);
232 if (error < 0)
233 goto failure;
226#endif 234#endif
227 do_gettimeofday(&nfssvc_boot); /* record boot time */ 235 do_gettimeofday(&nfssvc_boot); /* record boot time */
228 } else 236 } else
@@ -306,8 +314,6 @@ nfsd(struct svc_rqst *rqstp)
306 314
307 nfsdstats.th_cnt++; 315 nfsdstats.th_cnt++;
308 316
309 lockd_up(); /* start lockd */
310
311 me.task = current; 317 me.task = current;
312 list_add(&me.list, &nfsd_list); 318 list_add(&me.list, &nfsd_list);
313 319
@@ -364,13 +370,11 @@ nfsd(struct svc_rqst *rqstp)
364 break; 370 break;
365 killsig = signo; 371 killsig = signo;
366 } 372 }
367 /* Clear signals before calling lockd_down() and svc_exit_thread() */ 373 /* Clear signals before calling svc_exit_thread() */
368 flush_signals(current); 374 flush_signals(current);
369 375
370 lock_kernel(); 376 lock_kernel();
371 377
372 /* Release lockd */
373 lockd_down();
374 list_del(&me.list); 378 list_del(&me.list);
375 nfsdstats.th_cnt --; 379 nfsdstats.th_cnt --;
376 380