Author: markj
Date: Fri Nov 23 23:10:03 2018
New Revision: 340861
URL: https://svnweb.freebsd.org/changeset/base/340861

Log:
  Honour the waitok parameter in kevent_expand().
  
  Reviewed by:  kib
  MFC after:    1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:        https://reviews.freebsd.org/D18316

Modified:
  head/sys/kern/kern_event.c

Modified: head/sys/kern/kern_event.c
==============================================================================
--- head/sys/kern/kern_event.c  Fri Nov 23 23:07:57 2018        (r340860)
+++ head/sys/kern/kern_event.c  Fri Nov 23 23:10:03 2018        (r340861)
@@ -1686,10 +1686,6 @@ kqueue_schedtask(struct kqueue *kq)
  * Expand the kq to make sure we have storage for fops/ident pair.
  *
  * Return 0 on success (or no work necessary), return errno on failure.
- *
- * Not calling hashinit w/ waitok (proper malloc flag) should be safe.
- * If kqueue_register is called from a non-fd context, there usually/should
- * be no locks held.
  */
 static int
 kqueue_expand(struct kqueue *kq, struct filterops *fops, uintptr_t ident,
@@ -1734,8 +1730,9 @@ kqueue_expand(struct kqueue *kq, struct filterops *fop
                }
        } else {
                if (kq->kq_knhashmask == 0) {
-                       tmp_knhash = hashinit(KN_HASHSIZE, M_KQUEUE,
-                           &tmp_knhashmask);
+                       tmp_knhash = hashinit_flags(KN_HASHSIZE, M_KQUEUE,
+                           &tmp_knhashmask,
+                           waitok ? HASH_WAITOK : HASH_NOWAIT);
                        if (tmp_knhash == NULL)
                                return ENOMEM;
                        KQ_LOCK(kq);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to