Description of Problem: When mounting NFS mounts autofs will check to see if the mount is local by trying to connect to the UDP discard port and comparing IP addresses. If the connect() call fails autofs leaks the socket for the test. Version-Release number of selected component (if applicable): autofs-3.1.7-28 How Reproducible: Always. Steps to Reproduce: 1. disable UDP discard 2. put a local NFS mount in autofs map file. 3. see fd leaks, and slow performance because it'll use a local NFS mount instead of a bind mount. Actual Results: Expected Results: Additional Information: Here is a patch. diff -ru autofs-3.1.7-orig/modules/mount_nfs.c autofs-3.1.7/modules/mount_nfs.c --- autofs-3.1.7-orig/modules/mount_nfs.c Sat Nov 4 02:05:17 2000 +++ autofs-3.1.7/modules/mount_nfs.c Wed Aug 28 15:47:38 2002 @@ -123,9 +123,11 @@ len = sizeof(laddr); - if ( connect(sock, (struct sockaddr *) &saddr, sizeof(saddr)) < 0 ) + if ( connect(sock, (struct sockaddr *) &saddr, sizeof(saddr)) < 0 ) { + close(sock); continue; /* Assume it wasn't local */ - + } + if ( getsockname(sock, (struct sockaddr *) &laddr, &len) < 0 ) { syslog(LOG_ERR, MODPREFIX "getsockname failed for %s: %m", name); close(sock);
Just in case bugzilla mangles it I've mirrored the patch at... http://www.and.org/patches/autofs-3.1.7_fd-leak.patch
This fix will appear in RHEL 3 U3 and AS2.1 U5. Rawhide now uses autofs4, which already has this bugfix.