From: Jeff Layton <jlayton@redhat.com>
To: bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 2/5] nfsd: fix error handling when starting nfsd with rpcbind down
Date: Mon, 19 Jul 2010 16:50:05 -0400 [thread overview]
Message-ID: <1279572608-7234-3-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1279572608-7234-1-git-send-email-jlayton@redhat.com>
The refcounting for nfsd is a little goofy. What happens is that we
create the nfsd RPC service, attach sockets to it but don't actually
start the threads until someone writes to the "threads" procfile. To do
this, __write_ports_addfd will create the nfsd service and then will
decrement the refcount when exiting but won't actually destroy the
service.
This is fine when there aren't errors, but when there are this can
cause later attempts to start nfsd to fail. nfsd_serv will be set,
and that causes __write_versions to return EBUSY.
Fix this by calling svc_destroy on nfsd_serv when this function is
going to return error.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
fs/nfsd/nfsctl.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 508941c..af7469e 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -950,14 +950,18 @@ static ssize_t __write_ports_addfd(char *buf)
return err;
err = lockd_up();
- if (err != 0)
- goto out;
+ if (err != 0) {
+ svc_destroy(nfsd_serv);
+ return err;
+ }
err = svc_addsock(nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT);
- if (err < 0)
+ if (err < 0) {
lockd_down();
+ svc_destroy(nfsd_serv);
+ return err;
+ }
-out:
/* Decrease the count, but don't shut down the service */
nfsd_serv->sv_nrthreads--;
return err;
--
1.5.5.6
next prev parent reply other threads:[~2010-07-19 20:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-19 20:50 [PATCH 0/5] nfsd: fix error handling in write_ports interfaces (resend) Jeff Layton
2010-07-19 20:50 ` [PATCH 1/5] nfsd: don't try to shut down nfs4 state handling unless it's up Jeff Layton
2010-07-19 22:08 ` J. Bruce Fields
2010-07-20 0:54 ` Jeff Layton
2010-07-19 20:50 ` Jeff Layton [this message]
2010-07-19 20:50 ` [PATCH 3/5] nfsd: fix error handling in __write_ports_addxprt Jeff Layton
2010-07-19 20:50 ` [PATCH 4/5] nfsd: shut down NFSv4 state when nfsd_svc encounters an error Jeff Layton
2010-07-19 20:50 ` [PATCH 5/5] nfsd: just keep single lockd reference for nfsd Jeff Layton
2010-07-20 15:02 ` J. Bruce Fields
2010-07-20 15:43 ` Jeff Layton
2010-07-20 14:55 ` [PATCH 0/5] nfsd: fix error handling in write_ports interfaces (resend) J. Bruce Fields
2010-07-20 15:43 ` Jeff Layton
2010-07-20 15:56 ` J. Bruce Fields
2010-07-20 15:43 ` J. Bruce Fields
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=1279572608-7234-3-git-send-email-jlayton@redhat.com \
--to=jlayton@redhat.com \
--cc=bfields@fieldses.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).