linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: steved@redhat.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 2/7] mountd: Support TI-RPC mountd listener
Date: Mon, 20 Sep 2010 12:32:44 -0400	[thread overview]
Message-ID: <20100920163244.3170.72910.stgit@ellison.1015granger.net> (raw)
In-Reply-To: <20100920162616.3170.24625.stgit@ellison.1015granger.net>

If TI-RPC is available, use it to create mountd's svc listener.  If
not, use the old function, rpc_init(), to create mountd's listener.

IPv6 can be supported if TI-RPC is available.  In this case,
/etc/netconfig is searched to determine which transports to advertise.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/mountd/mountd.c |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index 753fd37..a4fdcc8 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -86,6 +86,11 @@ static int version3(void)
 	return nfs_version & NFSVERSBIT(3);
 }
 
+static int version23(void)
+{
+	return nfs_version & (NFSVERSBIT(2) | NFSVERSBIT(3));
+}
+
 static int version_any(void)
 {
 	return nfs_version & NFSVERSBIT_ALL;
@@ -95,11 +100,11 @@ static void
 unregister_services (void)
 {
 	if (version2()) {
-		pmap_unset (MOUNTPROG, MOUNTVERS);
-		pmap_unset (MOUNTPROG, MOUNTVERS_POSIX);
+		nfs_svc_unregister(MOUNTPROG, MOUNTVERS);
+		nfs_svc_unregister(MOUNTPROG, MOUNTVERS_POSIX);
 	}
 	if (version3())
-		pmap_unset (MOUNTPROG, MOUNTVERS_NFSV3);
+		nfs_svc_unregister(MOUNTPROG, MOUNTVERS_NFSV3);
 }
 
 static void
@@ -687,6 +692,7 @@ main(int argc, char **argv)
 {
 	char	*export_file = _PATH_EXPORTS;
 	char    *state_dir = NFS_STATEDIR;
+	unsigned int listeners = 0;
 	int	foreground = 0;
 	int	port = 0;
 	int	descriptors = 0;
@@ -830,14 +836,16 @@ main(int argc, char **argv)
 		cache_open();
 
 	if (version2()) {
-		rpc_init("mountd", MOUNTPROG, MOUNTVERS,
-			 mount_dispatch, port);
-		rpc_init("mountd", MOUNTPROG, MOUNTVERS_POSIX,
-			 mount_dispatch, port);
+		listeners += nfs_svc_create("mountd", MOUNTPROG,
+					MOUNTVERS, mount_dispatch, port);
+		listeners += nfs_svc_create("mountd", MOUNTPROG,
+					MOUNTVERS_POSIX, mount_dispatch, port);
 	}
 	if (version3())
-		rpc_init("mountd", MOUNTPROG, MOUNTVERS_NFSV3,
-			 mount_dispatch, port);
+		listeners += nfs_svc_create("mountd", MOUNTPROG,
+					MOUNTVERS_NFSV3, mount_dispatch, port);
+	if (version23() && listeners == 0)
+		xlog(L_FATAL, "mountd: could not create listeners\n");
 
 	sa.sa_handler = killer;
 	sigaction(SIGINT, &sa, NULL);


  parent reply	other threads:[~2010-09-20 16:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-20 16:32 [PATCH 0/7] The final patches for mountd IPv6 support Chuck Lever
2010-09-20 16:32 ` [PATCH 1/7] mountd: Make NFS version checks more strict Chuck Lever
2010-09-20 16:32 ` Chuck Lever [this message]
2010-09-20 16:32 ` [PATCH 3/7] mountd: Unregister mountd if my_svc_run() returns Chuck Lever
2010-09-20 16:33 ` [PATCH 4/7] mountd: Fix up version and usage messages Chuck Lever
2010-09-20 16:33 ` [PATCH 5/7] mountd: Use MNT status values instead of NFSERR Chuck Lever
2010-09-20 16:33 ` [PATCH 6/7] mountd: Update mountd/exportfs man pages to reflect IPv6 changes Chuck Lever
2010-09-20 16:33 ` [PATCH 7/7] nfsd: Enable IPv6 support in rpc.nfsd again Chuck Lever
     [not found] ` <20100920162616.3170.24625.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2010-09-28 12:08   ` [PATCH 0/7] The final patches for mountd IPv6 support Steve Dickson

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=20100920163244.3170.72910.stgit@ellison.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /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).