If we are "unsleepable" due to a dying proc, yield() instead of

returning directly.  This allows other threads to run possible
setting a condition we are waiting on.

Fixes a busyloop condition which could be entered from vfs_unmountall()
where we were waiting for vrele_pending and the vrele thread could
not run since we were hogging the CPU.
This commit is contained in:
pooka 2011-01-28 17:04:39 +00:00
parent 96de0bb9fe
commit 840bf0206b

View File

@ -1,4 +1,4 @@
/* $NetBSD: locks.c,v 1.49 2011/01/28 16:58:28 pooka Exp $ */
/* $NetBSD: locks.c,v 1.50 2011/01/28 17:04:39 pooka Exp $ */
/*
* Copyright (c) 2007, 2008 Antti Kantee. All Rights Reserved.
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.49 2011/01/28 16:58:28 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.50 2011/01/28 17:04:39 pooka Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@ -285,10 +285,11 @@ docvwait(kcondvar_t *cv, kmutex_t *mtx, struct timespec *ts)
if (__predict_false(l->l_flag & LW_RUMP_DYING)) {
/*
* sleepq code expects us to sleep, so set l_mutex
* back to cpu lock here if we didn't.
* yield() here, someone might want the cpu
* to set a condition. otherwise we'll just
* loop forever.
*/
l->l_mutex = l->l_cpu->ci_schedstate.spc_mutex;
yield();
return EINTR;
}