From: "J. Bruce Fields" <bfields@redhat.com>
To: Jeff Layton <jlayton@redhat.com>
Cc: linux-nfs@vger.kernel.org, "J. Bruce Fields" <bfields@redhat.com>
Subject: [PATCH 6/7] nfsd: move more into nfsd_startup()
Date: Wed, 21 Jul 2010 19:26:50 -0400 [thread overview]
Message-ID: <1279754811-8328-6-git-send-email-bfields@redhat.com> (raw)
In-Reply-To: <20100721232432.GA6689@fieldses.org>
This is just cleanup--it's harmless to call nfsd_rachache_init,
nfsd_init_socks, and nfsd_reset_versions more than once. But there's no
point to it.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
fs/nfsd/nfssvc.c | 69 +++++++++++++++++++++++++++--------------------------
1 files changed, 35 insertions(+), 34 deletions(-)
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 8a556ff..62a6c44 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -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;
}
@@ -209,8 +241,9 @@ static void nfsd_shutdown(void)
*/
if (!nfsd_up)
return;
- lockd_down();
nfs4_state_shutdown();
+ lockd_down();
+ nfsd_racache_shutdown();
nfsd_up = false;
}
@@ -218,7 +251,6 @@ 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 "
@@ -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)
@@ -419,11 +432,6 @@ 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) {
@@ -431,16 +439,9 @@ nfsd_svc(unsigned short port, int 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
--
1.7.0.4
next prev parent reply other threads:[~2010-07-21 23:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-21 13:21 [PATCH 5/5] nfsd: just keep single lockd reference for nfsd (try #4) Jeff Layton
2010-07-21 20:14 ` J. Bruce Fields
2010-07-21 23:24 ` J. Bruce Fields
2010-07-21 23:26 ` [PATCH 1/7] nfsd4: fix v4 state shutdown error paths J. Bruce Fields
2010-07-21 23:26 ` [PATCH 2/7] nfsd: fix error handling when starting nfsd with rpcbind down J. Bruce Fields
2010-07-21 23:26 ` [PATCH 3/7] nfsd: fix error handling in __write_ports_addxprt J. Bruce Fields
2010-07-21 23:26 ` [PATCH 4/7] nfsd: clean up nfsd_create_serv error handling J. Bruce Fields
2010-07-21 23:26 ` [PATCH 5/7] nfsd: just keep single lockd reference for nfsd J. Bruce Fields
2010-07-21 23:26 ` J. Bruce Fields [this message]
2010-07-21 23:26 ` [PATCH 7/7] nfsd: minor nfsd_svc() cleanup J. Bruce Fields
2010-07-22 17:40 ` [PATCH 5/5] nfsd: just keep single lockd reference for nfsd (try #4) Jeff Layton
[not found] ` <20100722134026.62091dc2-xSBYVWDuneFaJnirhKH9O4GKTjYczspe@public.gmane.org>
2010-07-23 12:55 ` J. Bruce Fields
2010-07-22 11:59 ` Staubach_Peter
2010-07-22 12:26 ` J. Bruce Fields
2010-07-22 12:36 ` Jeff Layton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1279754811-8328-6-git-send-email-bfields@redhat.com \
--to=bfields@redhat.com \
--cc=jlayton@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.