public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 5/5] NFSD: Create PF_INET6 listener in write_ports
Date: Tue, 26 Jan 2010 14:04:22 -0500	[thread overview]
Message-ID: <20100126190422.3368.3981.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100126190214.3368.89388.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

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.

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;
 }
 
 /*


  parent reply	other threads:[~2010-01-26 19:04 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   ` Chuck Lever [this message]
     [not found]     ` <20100126190422.3368.3981.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-01-26 23:30       ` [PATCH 5/5] NFSD: Create PF_INET6 listener in write_ports J. Bruce Fields
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=20100126190422.3368.3981.stgit@localhost.localdomain \
    --to=chuck.lever@oracle.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