Don't let the pagedaemon wait for pages, since that is just asking for

a deadlock.
This commit is contained in:
perseant 2006-03-28 01:29:55 +00:00
parent b307a01ecd
commit afc725a1c7

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vnops.c,v 1.158 2006/03/24 20:05:32 perseant Exp $ */
/* $NetBSD: lfs_vnops.c,v 1.159 2006/03/28 01:29:55 perseant Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.158 2006/03/24 20:05:32 perseant Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.159 2006/03/28 01:29:55 perseant Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1430,6 +1430,7 @@ check_dirty(struct lfs *fs, struct vnode *vp,
int dirty; /* number of dirty pages in a block */
int tdirty;
int pages_per_block = fs->lfs_bsize >> PAGE_SHIFT;
int pagedaemon = (curproc == uvm.pagedaemon_proc);
ASSERT_MAYBE_SEGLOCK(fs);
top:
@ -1486,14 +1487,13 @@ check_dirty(struct lfs *fs, struct vnode *vp,
* for the cleaner, while the cleaner waits for the
* segment lock. Just bail in that case.
*/
if ((pg->flags & PG_BUSY) && LFS_SEGLOCK_HELD(fs)) {
if (by_list) {
if (i > 0)
if ((pg->flags & PG_BUSY) &&
(pagedaemon || LFS_SEGLOCK_HELD(fs))) {
if (by_list && i > 0)
uvm_page_unbusy(pgs, i);
DLOG((DLOG_PAGE, "lfs_putpages: avoiding 3-way deadlock\n"));
DLOG((DLOG_PAGE, "lfs_putpages: avoiding 3-way or pagedaemon deadlock\n"));
return -1;
}
}
while (pg->flags & PG_BUSY) {
pg->flags |= PG_WANTED;