Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 206450
b: refs/heads/master
c: 774f8bb
h: refs/heads/master
v: v3
  • Loading branch information
J. Bruce Fields committed Aug 6, 2010
1 parent d13be79 commit 6c7c0b0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 039a87ca536a85bc169ce092e44bd57adfa1f563
refs/heads/master: 774f8bbd9ef2e71d4ef4b89933d292091d31ca98
30 changes: 16 additions & 14 deletions trunk/fs/nfsd/nfssvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ static bool nfsd_up = false;
static int nfsd_startup(unsigned short port, int nrservs)
{
int ret;

if (nfsd_up)
return 0;
/*
* Readahead param cache - will no-op if it already exists.
* (Note therefore results will be suboptimal if number of
Expand All @@ -217,7 +220,7 @@ static int nfsd_startup(unsigned short port, int nrservs)
goto out_racache;
ret = lockd_up();
if (ret)
return ret;
goto out_racache;
ret = nfs4_state_start();
if (ret)
goto out_lockd;
Expand Down Expand Up @@ -420,7 +423,7 @@ int
nfsd_svc(unsigned short port, int nrservs)
{
int error;
bool first_thread;
bool nfsd_up_before;

mutex_lock(&nfsd_mutex);
dprintk("nfsd: creating service\n");
Expand All @@ -432,29 +435,28 @@ nfsd_svc(unsigned short port, int nrservs)
if (nrservs == 0 && nfsd_serv == NULL)
goto out;

first_thread = (nfsd_serv->sv_nrthreads == 0) && (nrservs != 0);

if (first_thread) {
error = nfsd_startup(port, nrservs);
if (error)
goto out;
}
error = nfsd_create_serv();
if (error)
goto out_shutdown;
error = svc_set_num_threads(nfsd_serv, NULL, nrservs);
goto out;

nfsd_up_before = nfsd_up;

error = nfsd_startup(port, nrservs);
if (error)
goto out_destroy;
error = svc_set_num_threads(nfsd_serv, NULL, nrservs);
if (error)
goto out_shutdown;
/* 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;
out_destroy:
svc_destroy(nfsd_serv); /* Release server */
out_shutdown:
if (error < 0 && first_thread)
if (error < 0 && !nfsd_up_before)
nfsd_shutdown();
out_destroy:
svc_destroy(nfsd_serv); /* Release server */
out:
mutex_unlock(&nfsd_mutex);
return error;
Expand Down

0 comments on commit 6c7c0b0

Please sign in to comment.