ubc_fault: fix a deadlock in the case of uvm_loanbreak() failure.

This commit is contained in:
yamt 2006-08-18 15:03:21 +00:00
parent f83266c2e3
commit 36b78db59e
1 changed files with 11 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_bio.c,v 1.46 2006/05/03 15:57:35 yamt Exp $ */
/* $NetBSD: uvm_bio.c,v 1.47 2006/08/18 15:03:21 yamt Exp $ */
/*
* Copyright (c) 1998 Chuck Silvers.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.46 2006/05/03 15:57:35 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.47 2006/08/18 15:03:21 yamt Exp $");
#include "opt_uvmhist.h"
@ -341,9 +341,16 @@ again:
prot &= ~VM_PROT_WRITE;
if (prot & VM_PROT_WRITE) {
pg = uvm_loanbreak(pg);
if (pg == NULL)
struct vm_page *newpg;
newpg = uvm_loanbreak(pg);
if (newpg == NULL) {
uvm_page_unbusy(&pg, 1);
simple_unlock(&uobj->vmobjlock);
uvm_wait("ubc_loanbrk");
continue; /* will re-fault */
}
pg = newpg;
}
}