From: "J. Bruce Fields" <bfields@redhat.com>
To: Jeff Layton <jlayton@redhat.com>
Cc: linux-nfs@vger.kernel.org, Jeff Layton <jlayton@redhat.com>,
"J. Bruce Fields" <bfields@redhat.com>
Subject: [PATCH 3/7] nfsd: fix error handling in __write_ports_addxprt
Date: Wed, 21 Jul 2010 19:26:47 -0400 [thread overview]
Message-ID: <1279754811-8328-3-git-send-email-bfields@redhat.com> (raw)
In-Reply-To: <20100721232432.GA6689@fieldses.org>
From: Jeff Layton <jlayton@redhat.com>
__write_ports_addxprt calls nfsd_create_serv. That increases the
refcount of nfsd_serv (which is tracked in sv_nrthreads). The service
only decrements the thread count on error, not on success like
__write_ports_addfd does, so using this interface leaves the nfsd
thread count high.
Fix this by having this function call svc_destroy() on error to release
the reference (and possibly to tear down the service) and simply
decrement the refcount without tearing down the service on success.
This makes the sv_threads handling work basically the same in both
__write_ports_addxprt and __write_ports_addfd.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
fs/nfsd/nfsctl.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index af7469e..9e8645a 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1018,6 +1018,9 @@ static ssize_t __write_ports_addxprt(char *buf)
PF_INET6, port, SVC_SOCK_ANONYMOUS);
if (err < 0 && err != -EAFNOSUPPORT)
goto out_close;
+
+ /* Decrease the count, but don't shut down the service */
+ nfsd_serv->sv_nrthreads--;
return 0;
out_close:
xprt = svc_find_xprt(nfsd_serv, transport, PF_INET, port);
@@ -1026,8 +1029,7 @@ out_close:
svc_xprt_put(xprt);
}
out_err:
- /* Decrease the count, but don't shut down the service */
- nfsd_serv->sv_nrthreads--;
+ svc_destroy(nfsd_serv);
return err;
}
--
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 ` J. Bruce Fields [this message]
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 ` [PATCH 6/7] nfsd: move more into nfsd_startup() J. Bruce Fields
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-3-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 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).