]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Work around svc_getreqset in glibc 3
authorNeil Brown <neilb@suse.de>
Mon, 19 Mar 2007 00:12:34 +0000 (11:12 +1100)
committerNeil Brown <neilb@suse.de>
Mon, 19 Mar 2007 00:12:34 +0000 (11:12 +1100)
Without this fix, mountd ignores sockets with filedescriptor > 31,
so if there are more than about 26 concurrent connections, mountd
starts spinning.

utils/mountd/svc_run.c

index 7a8a595e2a60b7df657090fb0cd09918b736349e..422e839c171176638e66c32b53fa2af8a63f3886 100644 (file)
 void cache_set_fds(fd_set *fdset);
 int cache_process_req(fd_set *readfds);
 
 void cache_set_fds(fd_set *fdset);
 int cache_process_req(fd_set *readfds);
 
+#if LONG_MAX != INT_MAX        
+/* bug in glibc 2.3.6 and earlier, we need
+ * our own svc_getreqset
+ */
+static void
+my_svc_getreqset (fd_set *readfds)
+{
+       fd_mask mask;
+       fd_mask *maskp;
+       int setsize;
+       int sock;
+       int bit;
+
+       setsize = _rpc_dtablesize ();
+       if (setsize > FD_SETSIZE)
+               setsize = FD_SETSIZE;
+       maskp = readfds->fds_bits;
+       for (sock = 0; sock < setsize; sock += NFDBITS)
+               for (mask = *maskp++;
+                    (bit = ffsl (mask));
+                    mask ^= (1L << (bit - 1)))
+                       svc_getreq_common (sock + bit - 1);
+}
+#define svc_getreqset my_svc_getreqset
+
+#endif
 
 /*
  * The heart of the server.  A crib from libc for the most part...
 
 /*
  * The heart of the server.  A crib from libc for the most part...