From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 5/5] NFSD: Create PF_INET6 listener in write_ports
Date: Tue, 26 Jan 2010 18:30:19 -0500 [thread overview]
Message-ID: <20100126233019.GB806@fieldses.org> (raw)
In-Reply-To: <20100126190422.3368.3981.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
On Tue, Jan 26, 2010 at 02:04:22PM -0500, Chuck Lever wrote:
> Try to create a PF_INET6 listener for NFSD, if IPv6 is enabled in the
> kernel.
>
> Make sure nfsd_serv's reference count is decreased if
> __write_ports_addxprt() failed to create a listener. See
> __write_ports_addfd().
>
> Our current plan is to rely on rpc.nfsd to create appropriate IPv6
> listeners when server-side NFS/IPv6 support is desired. Legacy
> behavior, via the write_threads or write_svc kernel APIs, will remain
> the same -- only IPv4 listeners are created.
Looks fine, thanks, but:
>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>
> fs/nfsd/nfsctl.c | 20 +++++++++++++++++++-
> 1 files changed, 19 insertions(+), 1 deletions(-)
>
> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> index f43ecd6..f0a614e 100644
> --- a/fs/nfsd/nfsctl.c
> +++ b/fs/nfsd/nfsctl.c
> @@ -1003,8 +1003,26 @@ static ssize_t __write_ports_addxprt(char *buf)
> err = svc_create_xprt(nfsd_serv, transport,
> PF_INET, port, SVC_SOCK_ANONYMOUS);
> if (err < 0)
> - return err;
> + goto out_err;
> +
> + err = svc_create_xprt(nfsd_serv, transport,
> + PF_INET6, port, SVC_SOCK_ANONYMOUS);
> + if (err < 0 && err != -EAFNOSUPPORT) {
> + struct svc_xprt *xprt;
> + xprt = svc_find_xprt(nfsd_serv, transport, PF_INET, port);
> + if (xprt != NULL) {
> + svc_close_xprt(xprt);
> + svc_xprt_put(xprt);
> + }
> + goto out_err;
> + }
> +
> return 0;
> +
> +out_err:
> + /* Decrease the count, but don't shut down the service */
> + nfsd_serv->sv_nrthreads--;
> + return err;
> }
Any objection to moving the extra error-handling to the end, as in the
following? If there's no objection, I'll fold it into your last patch.
--b.
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index f0a614e..f4474e5 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -988,6 +988,7 @@ static ssize_t __write_ports_delfd(char *buf)
static ssize_t __write_ports_addxprt(char *buf)
{
char transport[16];
+ struct svc_xprt *xprt;
int port, err;
if (sscanf(buf, "%15s %4u", transport, &port) != 2)
@@ -1007,18 +1008,15 @@ static ssize_t __write_ports_addxprt(char *buf)
err = svc_create_xprt(nfsd_serv, transport,
PF_INET6, port, SVC_SOCK_ANONYMOUS);
- if (err < 0 && err != -EAFNOSUPPORT) {
- struct svc_xprt *xprt;
- xprt = svc_find_xprt(nfsd_serv, transport, PF_INET, port);
- if (xprt != NULL) {
- svc_close_xprt(xprt);
- svc_xprt_put(xprt);
- }
- goto out_err;
- }
-
+ if (err < 0 && err != -EAFNOSUPPORT)
+ goto out_err_cleanup_inet;
return 0;
-
+out_err_cleanup_inet:
+ xprt = svc_find_xprt(nfsd_serv, transport, PF_INET, port);
+ if (xprt != NULL) {
+ svc_close_xprt(xprt);
+ svc_xprt_put(xprt);
+ }
out_err:
/* Decrease the count, but don't shut down the service */
nfsd_serv->sv_nrthreads--;
next prev parent reply other threads:[~2010-01-26 23:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-26 19:03 [PATCH 0/5] Repost of remaining server-side IPv6 patches Chuck Lever
[not found] ` <20100126190214.3368.89388.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-01-26 19:03 ` [PATCH 1/5] SUNRPC: Use rpc_pton() in ip_map_parse() Chuck Lever
2010-01-26 19:03 ` [PATCH 2/5] NFSD: Support AF_INET6 in svc_addsock() function Chuck Lever
2010-01-26 19:04 ` [PATCH 3/5] SUNRPC: Bury "#ifdef IPV6" in svc_create_xprt() Chuck Lever
2010-01-26 19:04 ` [PATCH 4/5] SUNRPC: NFS kernel APIs shouldn't return ENOENT for "transport not found" Chuck Lever
2010-01-26 19:04 ` [PATCH 5/5] NFSD: Create PF_INET6 listener in write_ports Chuck Lever
[not found] ` <20100126190422.3368.3981.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-01-26 23:30 ` J. Bruce Fields [this message]
2010-01-27 21:18 ` Chuck Lever
2010-01-27 22:04 ` J. Bruce Fields
2010-01-26 23:30 ` [PATCH 0/5] Repost of remaining server-side IPv6 patches 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=20100126233019.GB806@fieldses.org \
--to=bfields@fieldses.org \
--cc=chuck.lever@oracle.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