[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>
This commit is contained in:
committed by
Linus Torvalds
parent
bc591ccff2
commit
24e36663c3
@ -134,6 +134,9 @@ static int killsig; /* signal that was used to kill last nfsd */
|
||||
static void nfsd_last_thread(struct svc_serv *serv)
|
||||
{
|
||||
/* When last nfsd thread exits we need to do some clean-up */
|
||||
struct svc_sock *svsk;
|
||||
list_for_each_entry(svsk, &serv->sv_permsocks, sk_list)
|
||||
lockd_down();
|
||||
nfsd_serv = NULL;
|
||||
nfsd_racache_shutdown();
|
||||
nfs4_state_shutdown();
|
||||
@ -218,11 +221,16 @@ nfsd_svc(unsigned short port, int nrservs)
|
||||
error = svc_makesock(nfsd_serv, IPPROTO_UDP, port);
|
||||
if (error < 0)
|
||||
goto failure;
|
||||
|
||||
error = lockd_up(IPPROTO_UDP);
|
||||
if (error < 0)
|
||||
goto failure;
|
||||
#ifdef CONFIG_NFSD_TCP
|
||||
error = svc_makesock(nfsd_serv, IPPROTO_TCP, port);
|
||||
if (error < 0)
|
||||
goto failure;
|
||||
error = lockd_up(IPPROTO_TCP);
|
||||
if (error < 0)
|
||||
goto failure;
|
||||
#endif
|
||||
do_gettimeofday(&nfssvc_boot); /* record boot time */
|
||||
} else
|
||||
@ -306,8 +314,6 @@ nfsd(struct svc_rqst *rqstp)
|
||||
|
||||
nfsdstats.th_cnt++;
|
||||
|
||||
lockd_up(); /* start lockd */
|
||||
|
||||
me.task = current;
|
||||
list_add(&me.list, &nfsd_list);
|
||||
|
||||
@ -364,13 +370,11 @@ nfsd(struct svc_rqst *rqstp)
|
||||
break;
|
||||
killsig = signo;
|
||||
}
|
||||
/* Clear signals before calling lockd_down() and svc_exit_thread() */
|
||||
/* Clear signals before calling svc_exit_thread() */
|
||||
flush_signals(current);
|
||||
|
||||
lock_kernel();
|
||||
|
||||
/* Release lockd */
|
||||
lockd_down();
|
||||
list_del(&me.list);
|
||||
nfsdstats.th_cnt --;
|
||||
|
||||
|
Reference in New Issue
Block a user