Revert "kqueue: Return value of knote_release is no longer useful."
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 3 May 2016 12:27:50 +0000 (20:27 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 3 May 2016 12:27:50 +0000 (20:27 +0800)
This reverts commit b75b5648541ea38deaf678ee62466780ffe62374.

Prepare to revert ed9db6a1912db34af387ff6978a265003258df16, which causes
panic under certain network load.

Reported-by: pavalos@
sys/kern/kern_event.c

index 34a24a3..2edc26c 100644 (file)
@@ -202,9 +202,11 @@ knote_acquire(struct knote *kn)
  *
  * Non-zero is returned if the knote is destroyed or detached.
  */
-static __inline void
+static __inline int
 knote_release(struct knote *kn)
 {
+       int ret;
+
        while (kn->kn_status & KN_REPROCESS) {
                kn->kn_status &= ~KN_REPROCESS;
                if (kn->kn_status & KN_WAITING) {
@@ -213,14 +215,19 @@ knote_release(struct knote *kn)
                }
                if (kn->kn_status & KN_DELETING) {
                        knote_detach_and_drop(kn);
-                       return;
+                       return(1);
                        /* NOT REACHED */
                }
                if (filter_event(kn, 0))
                        KNOTE_ACTIVATE(kn);
        }
+       if (kn->kn_status & KN_DETACHED)
+               ret = 1;
+       else
+               ret = 0;
        kn->kn_status &= ~KN_PROCESSING;
        /* kn should not be accessed anymore */
+       return ret;
 }
 
 static int