Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Nov 2018 23:10:04 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340861 - head/sys/kern
Message-ID:  <201811232310.wANNA4ct032945@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811232310.wANNA4ct032945>