rpms/autofs/F-11 autofs-5.0.4-fix-rpc-large-export-list.patch, NONE, 1.1 autofs.spec, 1.296, 1.297

Ian Kent iankent at fedoraproject.org
Fri Dec 4 13:54:23 UTC 2009


Author: iankent

Update of /cvs/pkgs/rpms/autofs/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv14271

Modified Files:
	autofs.spec 
Added Files:
	autofs-5.0.4-fix-rpc-large-export-list.patch 
Log Message:
%changelog
* Fri Dec 4 2009 Ian Kent <kpnt at redhat.com> - 1:5.0.4-48
- fix rpc fail on large export list (bz543023).


autofs-5.0.4-fix-rpc-large-export-list.patch:
 rpc_subs.c |   47 ++++++++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 23 deletions(-)

--- NEW FILE autofs-5.0.4-fix-rpc-large-export-list.patch ---
autofs-5.0.4 - fix rpc fail on large export list

From: Ian Kent <raven at themaw.net>

If the export list on a server is larger than the UDP transport packet
size the transfer will fail and autofs will try TCP instead, but there
were some problems with the conversion to allow for IPv6 using libtirpc.

When creating the local socket for an RPC connection we incorrectly
performed a connect instead of a bind to the ilocal TCP socket. Aslo the
timed connect, which should be done before creating the RPC client was
not being done, which can lead to lengthy timeouts.
---

 lib/rpc_subs.c |   47 ++++++++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 23 deletions(-)


--- autofs-5.0.4.orig/lib/rpc_subs.c
+++ autofs-5.0.4/lib/rpc_subs.c
@@ -53,6 +53,7 @@
 /* Get numeric value of the n bits starting at position p */
 #define getbits(x, p, n)      ((x >> (p + 1 - n)) & ~(~0 << n))
 
+static int connect_nb(int, struct sockaddr *, socklen_t, struct timeval *);
 inline void dump_core(void);
 
 static CLIENT *rpc_clntudp_create(struct sockaddr *addr, struct conn_info *info, int *fd)
@@ -97,11 +98,17 @@ static CLIENT *rpc_clnttcp_create(struct
 	struct sockaddr_in *in4_raddr;
 	struct sockaddr_in6 *in6_raddr;
 	CLIENT *client = NULL;
+	socklen_t slen;
 
 	switch (addr->sa_family) {
 	case AF_INET:
 		in4_raddr = (struct sockaddr_in *) addr;
 		in4_raddr->sin_port = htons(info->port);
+		slen = sizeof(struct sockaddr_in);
+
+		if (connect_nb(*fd, addr, slen, &info->timeout) < 0)
+			break;
+
 		client = clnttcp_create(in4_raddr,
 					info->program, info->version, fd,
 					info->send_sz, info->recv_sz);
@@ -114,6 +121,11 @@ static CLIENT *rpc_clnttcp_create(struct
 #else
 		in6_raddr = (struct sockaddr_in6 *) addr;
 		in6_raddr->sin6_port = htons(info->port);
+		slen = sizeof(struct sockaddr_in6);
+
+		if (connect_nb(*fd, addr, slen, &info->timeout) < 0)
+			break;
+
 		client = clnttcp6_create(in6_raddr,
 					 info->program, info->version, fd,
 					 info->send_sz, info->recv_sz);
@@ -260,32 +272,21 @@ static CLIENT *rpc_do_create_client(stru
 		return NULL;
 	}
 
+	if (!info->client) {
+		*fd = open_sock(addr->sa_family, type, proto);
+		if (*fd < 0)
+			return NULL;
+
+		if (bind(*fd, laddr, slen) < 0)
+			return NULL;
+	}
+
 	switch (info->proto->p_proto) {
 	case IPPROTO_UDP:
-		if (!info->client) {
-			*fd = open_sock(addr->sa_family, type, proto);
-			if (*fd < 0)
-				return NULL;
-
-			if (bind(*fd, laddr, slen) < 0) {
-				close(*fd);
-				return NULL;
-			}
-		}
 		client = rpc_clntudp_create(addr, info, fd);
 		break;
 
 	case IPPROTO_TCP:
-		if (!info->client) {
-			*fd = open_sock(addr->sa_family, type, proto);
-			if (*fd < 0)
-				return NULL;
-
-			if (connect_nb(*fd, laddr, slen, &info->timeout) < 0) {
-				close(*fd);
-				return NULL;
-			}
-		}
 		client = rpc_clnttcp_create(addr, info, fd);
 		break;
 
@@ -327,7 +328,7 @@ static CLIENT *create_udp_client(struct 
 		if (client)
 			goto done;
 
-		if (!info->client) {
+		if (!info->client && fd != RPC_ANYSOCK) {
 			close(fd);
 			fd = RPC_ANYSOCK;
 		}
@@ -352,7 +353,7 @@ static CLIENT *create_udp_client(struct 
 		if (client)
 			break;
 
-		if (!info->client) {
+		if (!info->client && fd != RPC_ANYSOCK) {
 			close(fd);
 			fd = RPC_ANYSOCK;
 		}
@@ -477,7 +478,7 @@ static CLIENT *create_tcp_client(struct 
 		if (client)
 			break;
 
-		if (!info->client) {
+		if (!info->client && fd != RPC_ANYSOCK) {
 			close(fd);
 			fd = RPC_ANYSOCK;
 		}


Index: autofs.spec
===================================================================
RCS file: /cvs/pkgs/rpms/autofs/F-11/autofs.spec,v
retrieving revision 1.296
retrieving revision 1.297
diff -u -p -r1.296 -r1.297
--- autofs.spec	25 Nov 2009 01:43:15 -0000	1.296
+++ autofs.spec	4 Dec 2009 13:54:23 -0000	1.297
@@ -4,7 +4,7 @@
 Summary: A tool for automatically mounting and unmounting filesystems
 Name: autofs
 Version: 5.0.4
-Release: 47
+Release: 48
 Epoch: 1
 License: GPLv2+
 Group: System Environment/Daemons
@@ -81,6 +81,7 @@ Patch68: autofs-5.0.5-fix-ext4-fsck-at-m
 Patch69: autofs-5.0.4-fix-typo-in-init-script.patch
 Patch70: autofs-5.0.4-fix-timeout-in-connect_nb.patch
 Patch71: autofs-5.0.5-fix-pidof-init-script-usage.patch
+Patch72: autofs-5.0.4-fix-rpc-large-export-list.patch
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs libtirpc-devel
 Requires: kernel >= 2.6.17
@@ -193,6 +194,7 @@ echo %{version}-%{release} > .version
 %patch69 -p1
 %patch70 -p1
 %patch71 -p1
+%patch72 -p1
 
 %build
 #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -245,6 +247,9 @@ fi
 %{_libdir}/autofs/
 
 %changelog
+* Fri Dec 4 2009 Ian Kent <kpnt at redhat.com> - 1:5.0.4-48
+- fix rpc fail on large export list (bz543023).
+
 * Wed Nov 25 2009 Ian Kent <ikent at redhat.com> - 1:5.0.4-47
 - fix pidof init script usage.
 




More information about the fedora-extras-commits mailing list