s3: Fix an infinite loop
authorVolker Lendecke <vl@samba.org>
Sun, 23 Jan 2011 08:12:43 +0000 (09:12 +0100)
committerVolker Lendecke <vlendec@samba.org>
Sun, 23 Jan 2011 09:05:39 +0000 (10:05 +0100)
If select returns EBADF (which should NEVER happen), then we loop infinitely
because the select masks seem all active.

I've been given an strace where smbd floods syslog with inotify-related
error messages. The strace shows that select returns EBADF, and we're calling
the inotify event callback. It then complains there's no data on the inotify
fd.

Metze, please check!

We might need to fix this in 3.4 and 3.5 as well. And we need to find the
deeper reason where we close a file descriptor and don't tell the events
system about it.

Volker

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun Jan 23 10:05:39 CET 2011 on sn-devel-104

source3/lib/events.c

index d987072884d361aed67b150582c2ea29fbbaa60e..802a2e57313f5a41078275a025f078ec44f918d2 100644 (file)
@@ -120,6 +120,10 @@ bool run_events(struct tevent_context *ev,
                return false;
        }
 
+       if (selrtn <= 0) {
+               return false;
+       }
+
        for (fde = ev->fd_events; fde; fde = fde->next) {
                uint16 flags = 0;