sleepq_block: fix a bug to lose biglocks in the case of recursive calls.

this fixes pf rb-tree corruption on my box.
This commit is contained in:
yamt 2008-08-11 02:36:25 +00:00
parent 06bd97aab2
commit 6198e821cb

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_sleepq.c,v 1.33 2008/06/17 09:11:25 ad Exp $ */
/* $NetBSD: kern_sleepq.c,v 1.34 2008/08/11 02:36:25 yamt Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.33 2008/06/17 09:11:25 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.34 2008/08/11 02:36:25 yamt Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -228,6 +228,7 @@ sleepq_block(int timo, bool catch)
struct proc *p;
lwp_t *l = curlwp;
bool early = false;
int biglocks = l->l_biglocks;
ktrcsw(1, 0);
@ -284,8 +285,8 @@ sleepq_block(int timo, bool catch)
}
ktrcsw(0, 0);
if (__predict_false(l->l_biglocks != 0)) {
KERNEL_LOCK(l->l_biglocks, NULL);
if (__predict_false(biglocks != 0)) {
KERNEL_LOCK(biglocks, NULL);
}
return error;
}