Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[linux-2.6-microblaze.git] / fs / nfsd / nfssvc.c
index cbba4a9..d4c9884 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)
@@ -413,6 +415,12 @@ nfsd_svc(unsigned short port, int nrservs)
                goto failure;
 
        error = svc_set_num_threads(nfsd_serv, NULL, nrservs);
+       if (error == 0)
+               /* We are holding a reference to nfsd_serv which
+                * we don't want to count in the return value,
+                * so subtract 1
+                */
+               error = nfsd_serv->sv_nrthreads - 1;
  failure:
        svc_destroy(nfsd_serv);         /* Release server */
  out: