Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 206441
b: refs/heads/master
c: 59db4a0
h: refs/heads/master
i:
  206439: 23abfc8
v: v3
  • Loading branch information
J. Bruce Fields committed Jul 23, 2010
1 parent d182242 commit 434d1a0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 35 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: ac77efbe2b4d2a1e571a4f1e5b6e47de72a7d737
refs/heads/master: 59db4a0c102e0de226a3395dbf25ea51bf845937
69 changes: 35 additions & 34 deletions trunk/fs/nfsd/nfssvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,22 +180,54 @@ int nfsd_nrthreads(void)
return rv;
}

static int nfsd_init_socks(int port)
{
int error;
if (!list_empty(&nfsd_serv->sv_permsocks))
return 0;

error = svc_create_xprt(nfsd_serv, "udp", PF_INET, port,
SVC_SOCK_DEFAULTS);
if (error < 0)
return error;

error = svc_create_xprt(nfsd_serv, "tcp", PF_INET, port,
SVC_SOCK_DEFAULTS);
if (error < 0)
return error;

return 0;
}

static bool nfsd_up = false;

static int nfsd_startup(unsigned short port, int nrservs)
{
int ret;

/*
* Readahead param cache - will no-op if it already exists.
* (Note therefore results will be suboptimal if number of
* threads is modified after nfsd start.)
*/
ret = nfsd_racache_init(2*nrservs);
if (ret)
return ret;
ret = nfsd_init_socks(port);
if (ret)
goto out_racache;
ret = lockd_up();
if (ret)
return ret;
ret = nfs4_state_start();
if (ret)
goto out_lockd;
nfsd_reset_versions();
nfsd_up = true;
return 0;
out_lockd:
lockd_down();
out_racache:
nfsd_racache_shutdown();
return ret;
}

Expand All @@ -209,16 +241,16 @@ static void nfsd_shutdown(void)
*/
if (!nfsd_up)
return;
lockd_down();
nfs4_state_shutdown();
lockd_down();
nfsd_racache_shutdown();
nfsd_up = false;
}

static void nfsd_last_thread(struct svc_serv *serv)
{
/* When last nfsd thread exits we need to do some clean-up */
nfsd_serv = NULL;
nfsd_racache_shutdown();
nfsd_shutdown();

printk(KERN_WARNING "nfsd: last server has exited, flushing export "
Expand Down Expand Up @@ -305,25 +337,6 @@ int nfsd_create_serv(void)
return err;
}

static int nfsd_init_socks(int port)
{
int error;
if (!list_empty(&nfsd_serv->sv_permsocks))
return 0;

error = svc_create_xprt(nfsd_serv, "udp", PF_INET, port,
SVC_SOCK_DEFAULTS);
if (error < 0)
return error;

error = svc_create_xprt(nfsd_serv, "tcp", PF_INET, port,
SVC_SOCK_DEFAULTS);
if (error < 0)
return error;

return 0;
}

int nfsd_nrpools(void)
{
if (nfsd_serv == NULL)
Expand Down Expand Up @@ -419,28 +432,16 @@ nfsd_svc(unsigned short port, int nrservs)
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)
goto out;

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

if (first_thread) {
error = nfsd_startup(port, nrservs);
if (error)
goto out;
}

nfsd_reset_versions();

error = nfsd_create_serv();
if (error)
goto out_shutdown;
error = nfsd_init_socks(port);
if (error)
goto out_destroy;

error = svc_set_num_threads(nfsd_serv, NULL, nrservs);
if (error == 0)
/* We are holding a reference to nfsd_serv which
Expand Down

0 comments on commit 434d1a0

Please sign in to comment.