nfsd: fix error handling when starting nfsd with rpcbind down
authorJeff Layton <jlayton@redhat.com>
Mon, 19 Jul 2010 20:50:05 +0000 (16:50 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 23 Jul 2010 12:51:23 +0000 (08:51 -0400)
commit78a8d7c8ca3f0cb5cd2a276c6fc17c8c006d0b3c
tree852f2db0fe35f7e88bedd9b4a182cb8b045b3c27
parent4ad9a344be2291b1e594a4a5aee25c5a5df34a97
nfsd: fix error handling when starting nfsd with rpcbind down

The refcounting for nfsd is a little goofy. What happens is that we
create the nfsd RPC service, attach sockets to it but don't actually
start the threads until someone writes to the "threads" procfile. To do
this, __write_ports_addfd will create the nfsd service and then will
decrement the refcount when exiting but won't actually destroy the
service.

This is fine when there aren't errors, but when there are this can
cause later attempts to start nfsd to fail. nfsd_serv will be set,
and that causes __write_versions to return EBUSY.

Fix this by calling svc_destroy on nfsd_serv when this function is
going to return error.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfsctl.c