Don't try to re-insert an already present but invalid page.

This could happen if a thread doing a page-in loses a ZFS range lock
race to a thread writing to the same range

This fixes "panic: vm_page_alloc: pindex already allocated" in
http://docs.FreeBSD.org/cgi/mid.cgi?1372165971.96049.42.camel

Submitted by:	avg
MFC after:	1 week
This commit is contained in:
Gavin Atkinson 2013-06-28 07:51:12 +00:00
parent 4dfaf1bc08
commit af582854d8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=252337

View File

@ -345,10 +345,13 @@ page_busy(vnode_t *vp, int64_t start, int64_t off, int64_t nbytes)
vm_page_sleep(pp, "zfsmwb");
continue;
}
} else {
} else if (pp == NULL) {
pp = vm_page_alloc(obj, OFF_TO_IDX(start),
VM_ALLOC_SYSTEM | VM_ALLOC_IFCACHED |
VM_ALLOC_NOBUSY);
} else {
ASSERT(pp != NULL && !pp->valid);
pp = NULL;
}
if (pp != NULL) {