SUNRPC: Fix rpcauth_prune_expired
[safe/jmp/linux-2.6] / fs / eventpoll.c
index 3fd4014..aec5c13 100644 (file)
@@ -927,12 +927,16 @@ errxit:
        /*
         * During the time we spent in the loop above, some other events
         * might have been queued by the poll callback. We re-insert them
-        * here (in case they are not already queued, or they're one-shot).
+        * inside the main ready-list here.
         */
        for (nepi = ep->ovflist; (epi = nepi) != NULL;
             nepi = epi->next, epi->next = EP_UNACTIVE_PTR) {
-               if (!ep_is_linked(&epi->rdllink) &&
-                   (epi->event.events & ~EP_PRIVATE_BITS))
+               /*
+                * If the above loop quit with errors, the epoll item might still
+                * be linked to "txlist", and the list_splice() done below will
+                * take care of those cases.
+                */
+               if (!ep_is_linked(&epi->rdllink))
                        list_add_tail(&epi->rdllink, &ep->rdllist);
        }
        /*
@@ -1041,28 +1045,27 @@ retry:
 }
 
 /*
- * It opens an eventpoll file descriptor. The "size" parameter is there
- * for historical reasons, when epoll was using an hash instead of an
- * RB tree. With the current implementation, the "size" parameter is ignored
- * (besides sanity checks).
+ * Open an eventpoll file descriptor.
  */
-asmlinkage long sys_epoll_create2(int size, int flags)
+asmlinkage long sys_epoll_create1(int flags)
 {
        int error, fd = -1;
        struct eventpoll *ep;
 
+       /* Check the EPOLL_* constant for consistency.  */
+       BUILD_BUG_ON(EPOLL_CLOEXEC != O_CLOEXEC);
+
        if (flags & ~EPOLL_CLOEXEC)
                return -EINVAL;
 
        DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d)\n",
-                    current, size));
+                    current, flags));
 
        /*
-        * Sanity check on the size parameter, and create the internal data
-        * structure ( "struct eventpoll" ).
+        * Create the internal data structure ( "struct eventpoll" ).
         */
-       error = -EINVAL;
-       if (size <= 0 || (error = ep_alloc(&ep)) < 0) {
+       error = ep_alloc(&ep);
+       if (error < 0) {
                fd = error;
                goto error_return;
        }
@@ -1078,14 +1081,17 @@ asmlinkage long sys_epoll_create2(int size, int flags)
 
 error_return:
        DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d) = %d\n",
-                    current, size, fd));
+                    current, flags, fd));
 
        return fd;
 }
 
 asmlinkage long sys_epoll_create(int size)
 {
-       return sys_epoll_create2(size, 0);
+       if (size < 0)
+               return -EINVAL;
+
+       return sys_epoll_create1(0);
 }
 
 /*