rpms/kernel/devel linux-2.6.28-sunrpc-ipv6-rpcbind.patch, NONE, 1.1 kernel.spec, 1.1227, 1.1228

Dave Jones davej at fedoraproject.org
Fri Jan 23 20:20:26 UTC 2009


Author: davej

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25750

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6.28-sunrpc-ipv6-rpcbind.patch 
Log Message:
Make NFS work again.

linux-2.6.28-sunrpc-ipv6-rpcbind.patch:

--- NEW FILE linux-2.6.28-sunrpc-ipv6-rpcbind.patch ---
diff -up linux-2.6.28.i686/fs/Kconfig.save linux-2.6.28.i686/fs/Kconfig
--- linux-2.6.28.i686/fs/Kconfig.save	2009-01-23 14:04:47.000000000 -0500
+++ linux-2.6.28.i686/fs/Kconfig	2009-01-23 14:15:31.000000000 -0500
@@ -1401,28 +1401,6 @@ config SUNRPC_XPRT_RDMA
 
 	  If unsure, say N.
 
-config SUNRPC_REGISTER_V4
-	bool "Register local RPC services via rpcbind v4 (EXPERIMENTAL)"
-	depends on SUNRPC && EXPERIMENTAL
-	default n
-	help
-	  Sun added support for registering RPC services at an IPv6
-	  address by creating two new versions of the rpcbind protocol
-	  (RFC 1833).
-
-	  This option enables support in the kernel RPC server for
-	  registering kernel RPC services via version 4 of the rpcbind
-	  protocol.  If you enable this option, you must run a portmapper
-	  daemon that supports rpcbind protocol version 4.
-
-	  Serving NFS over IPv6 from knfsd (the kernel's NFS server)
-	  requires that you enable this option and use a portmapper that
-	  supports rpcbind version 4.
-
-	  If unsure, say N to get traditional behavior (register kernel
-	  RPC services using only rpcbind version 2).  Distributions
-	  using the legacy Linux portmapper daemon must say N here.
-
 config RPCSEC_GSS_KRB5
 	tristate "Secure RPC: Kerberos V mechanism (EXPERIMENTAL)"
 	depends on SUNRPC && EXPERIMENTAL
diff -up linux-2.6.28.i686/fs/lockd/svc.c.save linux-2.6.28.i686/fs/lockd/svc.c
--- linux-2.6.28.i686/fs/lockd/svc.c.save	2009-01-23 14:04:47.000000000 -0500
+++ linux-2.6.28.i686/fs/lockd/svc.c	2009-01-23 14:15:31.000000000 -0500
@@ -56,12 +56,11 @@ unsigned long			nlmsvc_timeout;
  * If the kernel has IPv6 support available, always listen for
  * both AF_INET and AF_INET6 requests.
  */
-#if (defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)) && \
-	defined(CONFIG_SUNRPC_REGISTER_V4)
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 static const sa_family_t	nlmsvc_family = AF_INET6;
-#else	/* (CONFIG_IPV6 || CONFIG_IPV6_MODULE) && CONFIG_SUNRPC_REGISTER_V4 */
+#else	/* CONFIG_IPV6 || CONFIG_IPV6_MODULE */
 static const sa_family_t	nlmsvc_family = AF_INET;
-#endif	/* (CONFIG_IPV6 || CONFIG_IPV6_MODULE) && CONFIG_SUNRPC_REGISTER_V4 */
+#endif	/* CONFIG_IPV6 || CONFIG_IPV6_MODULE */
 
 /*
  * These can be set at insmod time (useful for NFS as root filesystem),
diff -up linux-2.6.28.i686/net/sunrpc/rpcb_clnt.c.save linux-2.6.28.i686/net/sunrpc/rpcb_clnt.c
--- linux-2.6.28.i686/net/sunrpc/rpcb_clnt.c.save	2009-01-23 14:04:47.000000000 -0500
+++ linux-2.6.28.i686/net/sunrpc/rpcb_clnt.c	2009-01-23 14:14:41.000000000 -0500
@@ -124,12 +124,6 @@ static const struct sockaddr_in rpcb_ina
 	.sin_port		= htons(RPCBIND_PORT),
 };
 
-static const struct sockaddr_in6 rpcb_in6addr_loopback = {
-	.sin6_family		= AF_INET6,
-	.sin6_addr		= IN6ADDR_LOOPBACK_INIT,
-	.sin6_port		= htons(RPCBIND_PORT),
-};
-
 static struct rpc_clnt *rpcb_create_local(struct sockaddr *addr,
 					  size_t addrlen, u32 version)
 {
@@ -176,9 +170,10 @@ static struct rpc_clnt *rpcb_create(char
 	return rpc_create(&args);
 }
 
-static int rpcb_register_call(struct sockaddr *addr, size_t addrlen,
-			      u32 version, struct rpc_message *msg)
+static int rpcb_register_call(u32 version, struct rpc_message *msg)
 {
+	struct sockaddr *addr = (struct sockaddr *)&rpcb_inaddr_loopback;
+	size_t addrlen = sizeof(rpcb_inaddr_loopback);
 	struct rpc_clnt *rpcb_clnt;
 	int result, error = 0;
 
@@ -192,7 +187,7 @@ static int rpcb_register_call(struct soc
 		error = PTR_ERR(rpcb_clnt);
 
 	if (error < 0) {
-		printk(KERN_WARNING "RPC: failed to contact local rpcbind "
+		dprintk("RPC:       failed to contact local rpcbind "
 				"server (errno %d).\n", -error);
 		return error;
 	}
@@ -254,9 +249,7 @@ int rpcb_register(u32 prog, u32 vers, in
 	if (port)
 		msg.rpc_proc = &rpcb_procedures2[RPCBPROC_SET];
 
-	return rpcb_register_call((struct sockaddr *)&rpcb_inaddr_loopback,
-					sizeof(rpcb_inaddr_loopback),
-					RPCBVERS_2, &msg);
+	return rpcb_register_call(RPCBVERS_2, &msg);
 }
 
 /*
@@ -284,9 +277,7 @@ static int rpcb_register_netid4(struct s
 	if (port)
 		msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET];
 
-	return rpcb_register_call((struct sockaddr *)&rpcb_inaddr_loopback,
-					sizeof(rpcb_inaddr_loopback),
-					RPCBVERS_4, msg);
+	return rpcb_register_call(RPCBVERS_4, msg);
 }
 
 /*
@@ -318,9 +309,7 @@ static int rpcb_register_netid6(struct s
 	if (port)
 		msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET];
 
-	return rpcb_register_call((struct sockaddr *)&rpcb_in6addr_loopback,
-					sizeof(rpcb_in6addr_loopback),
-					RPCBVERS_4, msg);
+	return rpcb_register_call(RPCBVERS_4, msg);
 }
 
 /**
diff -up linux-2.6.28.i686/net/sunrpc/svc.c.save linux-2.6.28.i686/net/sunrpc/svc.c
--- linux-2.6.28.i686/net/sunrpc/svc.c.save	2009-01-23 14:04:47.000000000 -0500
+++ linux-2.6.28.i686/net/sunrpc/svc.c	2009-01-23 14:14:41.000000000 -0500
@@ -719,8 +719,6 @@ svc_exit_thread(struct svc_rqst *rqstp)
 }
 EXPORT_SYMBOL_GPL(svc_exit_thread);
 
-#ifdef CONFIG_SUNRPC_REGISTER_V4
-
 /*
  * Register an "inet" protocol family netid with the local
  * rpcbind daemon via an rpcbind v4 SET request.
@@ -741,6 +739,7 @@ static int __svc_rpcb_register4(const u3
 		.sin_port		= htons(port),
 	};
 	char *netid;
+	int error;
 
 	switch (protocol) {
 	case IPPROTO_UDP:
@@ -750,11 +749,20 @@ static int __svc_rpcb_register4(const u3
 		netid = RPCBIND_NETID_TCP;
 		break;
 	default:
-		return -EPROTONOSUPPORT;
+		return -ENOPROTOOPT;
 	}
 
-	return rpcb_v4_register(program, version,
-				(struct sockaddr *)&sin, netid);
+	error = rpcb_v4_register(program, version,
+					(struct sockaddr *)&sin, netid);
+
+	/*
+	 * User space didn't support rpcbind v4, so retry this
+	 * registration request with the legacy rpcbind v2 protocol.
+	 */
+	if (error == -EPROTONOSUPPORT)
+		error = rpcb_register(program, version, protocol, port);
+
+	return error;
 }
 
 /*
@@ -777,6 +785,7 @@ static int __svc_rpcb_register6(const u3
 		.sin6_port		= htons(port),
 	};
 	char *netid;
+	int error;
 
 	switch (protocol) {
 	case IPPROTO_UDP:
@@ -786,11 +795,21 @@ static int __svc_rpcb_register6(const u3
 		netid = RPCBIND_NETID_TCP6;
 		break;
 	default:
-		return -EPROTONOSUPPORT;
+		return -ENOPROTOOPT;
 	}
 
-	return rpcb_v4_register(program, version,
+	error = rpcb_v4_register(program, version,
 				(struct sockaddr *)&sin6, netid);
+
+	/*
+	 * User space didn't support registering an IPv6 service,
+	 * so register this service for IPv4 only, using the legacy
+	 * rpcbind v2 protocol.
+	 */
+	if (error == -EPROTONOSUPPORT)
+		error = rpcb_register(program, version, protocol, port);
+
+	return error;
 }
 
 /*
@@ -799,7 +818,8 @@ static int __svc_rpcb_register6(const u3
  * Returns zero on success; a negative errno value is returned
  * if any error occurs.
  */
-static int __svc_register(const u32 program, const u32 version,
+static int __svc_register(const char *progname,
+			  const u32 program, const u32 version,
 			  const sa_family_t family,
 			  const unsigned short protocol,
 			  const unsigned short port)
@@ -808,13 +828,14 @@ static int __svc_register(const u32 prog
 
 	switch (family) {
 	case AF_INET:
-		return __svc_rpcb_register4(program, version,
+		error = __svc_rpcb_register4(program, version,
 						protocol, port);
+		break;
 	case AF_INET6:
 		error = __svc_rpcb_register6(program, version,
 						protocol, port);
 		if (error < 0)
-			return error;
+			break;
 
 		/*
 		 * Work around bug in some versions of Linux rpcbind
@@ -825,33 +846,17 @@ static int __svc_register(const u32 prog
 		 */
 		__svc_rpcb_register4(program, version,
 						protocol, port);
-		return 0;
+		break;
+	default:
+		error = -EAFNOSUPPORT;
 	}
 
-	return -EAFNOSUPPORT;
-}
-
-#else	/* CONFIG_SUNRPC_REGISTER_V4 */
-
-/*
- * Register a kernel RPC service via rpcbind version 2.
- *
- * Returns zero on success; a negative errno value is returned
- * if any error occurs.
- */
-static int __svc_register(const u32 program, const u32 version,
-			  sa_family_t family,
-			  const unsigned short protocol,
-			  const unsigned short port)
-{
-	if (family != AF_INET)
-		return -EAFNOSUPPORT;
-
-	return rpcb_register(program, version, protocol, port);
+	if (error < 0)
+		printk(KERN_WARNING "svc: failed to register %sv%u RPC "
+			"service (errno %d).\n", progname, version, -error);
+	return error;
 }
 
-#endif /* CONFIG_SUNRPC_REGISTER_V4 */
-
 /**
  * svc_register - register an RPC service with the local portmapper
  * @serv: svc_serv struct for the service to register
@@ -886,8 +891,9 @@ int svc_register(const struct svc_serv *
 			if (progp->pg_vers[i]->vs_hidden)
 				continue;
 
-			error = __svc_register(progp->pg_prog, i,
-						serv->sv_family, proto, port);
+			error = __svc_register(progp->pg_name, progp->pg_prog,
+						i, serv->sv_family,
+						proto, port);
 			if (error < 0)
 				break;
 		}
@@ -896,26 +902,10 @@ int svc_register(const struct svc_serv *
 	return error;
 }
 
-#ifdef CONFIG_SUNRPC_REGISTER_V4
-
-static void __svc_unregister(const u32 program, const u32 version,
-			     const char *progname)
-{
-	struct sockaddr_in6 sin6 = {
-		.sin6_family		= AF_INET6,
-		.sin6_addr		= IN6ADDR_ANY_INIT,
-		.sin6_port		= 0,
-	};
-	int error;
-
-	error = rpcb_v4_register(program, version,
-				(struct sockaddr *)&sin6, "");
-	dprintk("svc: %s(%sv%u), error %d\n",
-			__func__, progname, version, error);
-}
-
-#else	/* CONFIG_SUNRPC_REGISTER_V4 */
-
+/*
+ * Olaf says a v2 UNSET should clear _all_ entries, including any
+ * registered via a v4 SET
+ */
 static void __svc_unregister(const u32 program, const u32 version,
 			     const char *progname)
 {
@@ -926,8 +916,6 @@ static void __svc_unregister(const u32 p
 			__func__, progname, version, error);
 }
 
-#endif	/* CONFIG_SUNRPC_REGISTER_V4 */
-
 /*
  * All netids, bind addresses and ports registered for [program, version]
  * are removed from the local rpcbind database (if the service is not


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1227
retrieving revision 1.1228
diff -u -r1.1227 -r1.1228
--- kernel.spec	23 Jan 2009 19:28:10 -0000	1.1227
+++ kernel.spec	23 Jan 2009 20:19:55 -0000	1.1228
@@ -656,6 +656,8 @@
 Patch2200: linux-2.6-firewire-git-update.patch
 Patch2201: linux-2.6-firewire-git-pending.patch
 
+Patch2300: linux-2.6.28-sunrpc-ipv6-rpcbind.patch
+
 # Quiet boot fixes
 # silence the ACPI blacklist code
 Patch2802: linux-2.6-silence-acpi-blacklist.patch
@@ -1165,6 +1167,9 @@
 ApplyPatch linux-2.6-firewire-git-pending.patch
 fi
 
+# Fix NFS
+ApplyPatch linux-2.6.28-sunrpc-ipv6-rpcbind.patch
+
 # silence the ACPI blacklist code
 ApplyPatch linux-2.6-silence-acpi-blacklist.patch
 
@@ -1751,6 +1756,9 @@
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Fri Jan 23 2009 Dave Jones <davej at redhat.com>
+- Make NFS work again.
+
 * Fri Jan 23 2009 Eric Sandeen <sandeen at redhat.com>
 - build the crc32c driver into the kernel
 - add selinux fixes for btrfs




More information about the scm-commits mailing list