Back out rev 1.149.

From various discussion about vndstrategy (see
http://mail-index.netbsd.org/tech-kern/2005/03/29/0034.html
http://mail-index.netbsd.org/tech-kern/2005/03/23/0015.html)
it's not correct to tsleep() in a strategy routine, which may be called from
interrupt context.
Unfortunably this reopens PR/10731, PR/12189, PR/20296, PR/34293

As for what the correct fix it, this needs to be analysed deeper. I suspect
throttling the caller in vnd only hides the problem; the same caller writing
to some other device could exaust all buffers as well. If this driver doesn't
need to allocate buffer this won't cause a deadlock, but it's bad for
performances on systems with e.g. multiple drives. Also, others stacked
block device drivers may also have this issue.
This commit is contained in:
bouyer 2006-09-03 19:49:34 +00:00
parent d31581e06a
commit 2aee9a0f50
1 changed files with 2 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vnd.c,v 1.149 2006/08/27 18:45:20 christos Exp $ */
/* $NetBSD: vnd.c,v 1.150 2006/09/03 19:49:34 bouyer Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -133,7 +133,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.149 2006/08/27 18:45:20 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.150 2006/09/03 19:49:34 bouyer Exp $");
#if defined(_KERNEL_OPT)
#include "fs_nfs.h"
@ -507,9 +507,6 @@ vndstrategy(struct buf *bp)
if (vnddebug & VDB_FOLLOW)
printf("vndstrategy(%p): unit %d\n", bp, unit);
#endif
while (vnd->sc_maxactive > 0 && vnd->sc_active >= vnd->sc_maxactive) {
tsleep(&vnd->sc_tab, PRIBIO, "vndac", 0);
}
BUFQ_PUT(vnd->sc_tab, bp);
wakeup(&vnd->sc_tab);
splx(s);