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
This commit is contained in:
Mark Johnston 2018-11-23 23:10:03 +00:00
parent f5cf758998
commit 96fdfb3649
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=340861

View File

@ -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 *fops, uintptr_t ident,
}
} 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);