]> git.karo-electronics.de Git - linux-beck.git/commitdiff
nfsd: optimise the starting of zero threads when none are running.
authorNeilBrown <neilb@suse.de>
Tue, 16 Jun 2009 01:03:20 +0000 (11:03 +1000)
committerJ. Bruce Fields <bfields@citi.umich.edu>
Thu, 18 Jun 2009 16:42:41 +0000 (09:42 -0700)
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>
fs/nfsd/nfssvc.c

index 209eaa0885d10d5e2bdc98ac8327358b793fbaa6..d4c9884cd54b2bf680cc2360eaa1a9f20dec8b55 100644 (file)
@@ -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)