Skip to content

Commit

Permalink
nfsd: optimise the starting of zero threads when none are running.
Browse files Browse the repository at this point in the history
Currently, if we ask to set then number of nfsd threads to zero when
there are none running, we set up all the sockets and register the
service, and then tear it all down again.
This is pointless.

So detect that case and exit promptly.
(also remove an assignment to 'error' which was never used.

Signed-off-by: NeilBrown <neilb@suse.de>
Acked-by: Jeff Layton <jlayton@redhat.com>
  • Loading branch information
NeilBrown authored and J. Bruce Fields committed Jun 18, 2009
1 parent 82e12fe commit 671e1fc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/nfsd/nfssvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,14 @@ nfsd_svc(unsigned short port, int nrservs)

mutex_lock(&nfsd_mutex);
dprintk("nfsd: creating service\n");
error = -EINVAL;
if (nrservs <= 0)
nrservs = 0;
if (nrservs > NFSD_MAXSERVS)
nrservs = NFSD_MAXSERVS;

error = 0;
if (nrservs == 0 && nfsd_serv == NULL)
goto out;

/* Readahead param cache - will no-op if it already exists */
error = nfsd_racache_init(2*nrservs);
if (error<0)
Expand Down

0 comments on commit 671e1fc

Please sign in to comment.